Type: RemoteJudge 1000ms 512MiB

武器购买

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.

题目描述

商店里有 nn 个武器,第 ii 个武器的强度为 pip_i,花费为 cic_i

小杨想要购买一些武器,满足这些武器的总强度不小于 PP,总花费不超过 QQ,小杨想知道是否存在满足条件的购买方案,如果有,最少花费又是多少。

输入格式

第一行包含一个正整数 tt,代表测试数据组数。

对于每组测试数据,第一行包含三个正整数 n,P,Qn,P,Q,含义如题面所示。

之后 nn 行,每行包含两个正整数 pi,cip_i,c_i,代表武器的强度和花费。

输出格式

对于每组测试数据,如果存在满足条件的购买方案,输出最少花费,否则输出 -1

3
3 2 3
1 2
1 2
2 3
3 3 4
1 2
1 2
2 3
3 1000 1000
1 2
1 2
2 3
3
-1
-1

提示

子任务编号 数据点占比 nn pip_i cic_i PP QQ
11 20%20\% 10\leq 10 11 11 10\leq 10
22 100\leq 100 5×104\leq 5\times 10^4 5×104\leq 5\times 10^4 22
33 60%60\% 5×104\leq 5\times 10^4 5×104\leq 5\times 10^4

对于全部数据,保证有 1t101\leq t\leq 101n1001\leq n\leq 1001pi,ci,P,Q5×1041\leq p_i,c_i,P,Q\leq 5\times 10^4

2025 C25夏令营挑战赛1

Not Attended
Status
Done
Rule
IOI
Problem
9
Start at
2025-7-8 16:20
End at
2025-7-8 18:20
Duration
2 hour(s)
Host
Partic.
37