Type: Default 1000ms 256MiB

Bob的背包

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

Bob 来到一家现购自运商店,将 nn 件商品放入了他的手推车,然后到收银台付款。每件商品由它的价格 cic_i 和收银员扫描它的时间 tit_i 秒定义。

当收银员正在扫描某件商品时,Bob 可以从他的手推车中偷走某些其它商品。Bob 需要恰好 11 秒来偷走一件商品。Bob 需要付给收银员的最少钱数是多少?请记住,收银员扫描商品的顺序由 Bob 决定。

输入格式

输入第一行包含数 nn1n20001 \le n \le 2000)。接下来 nn 行每行每件商品由一对数 tit_icic_i0ti20000 \le t_i \le 20001ci1091 \le c_i \le 10^9)描述。如果 tit_i00,那么当收银员扫描商品 ii 时,Bob 不能偷任何东西。

输出格式

输出一个数字—— Bob 需要支付的最小金额是多少。

4
2 10
0 20
1 5
1 3
8
3
0 1
0 10
0 100
111

0315

Not Attended
Status
Done
Rule
XCPC
Problem
6
Start at
2026-3-15 14:00
End at
2026-3-15 17:21
Duration
3.4 hour(s)
Host
Partic.
82