33OJ
登录 注册

C. 便当装盒 / Bento Packing

    传统题 1000ms 256MiB

便当装盒 / Bento Packing

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Statement

There are NN side dishes.

The ii-th side dish has a deliciousness of AiA_i and a volume of BiB_i.

You will choose some of the side dishes so that the total volume of the chosen dishes is at most WW, and pack them into a lunch box.

Find the maximum possible total deliciousness of the chosen side dishes.

Constraints

  • 1≤N≤201 \leq N \leq 20
  • 1≤W≤1091 \leq W \leq 10^9
  • 1≤Ai,Bi≤1091 \leq A_i, B_i \leq 10^9
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

  • NN WW
  • A1A_1 B1B_1
  • A2A_2 B2B_2
  • ⋮\vdots
  • ANA_N BNB_N

Output

Output the answer.

4 13
4 5
3 3
5 9
8 6
12

If you pack the 11-st and 44-th side dishes into the lunch box, the total deliciousness is 1212 and the total volume is 1111.

3 99
1 100
10 100
100 100
0

You may also pack no side dishes.

5 9
6 4
9 1
2 1
4 3
5 4
21

ABC479 赛后模拟赛 ✅️

未参加
状态
已结束
规则
IOI
题目
7
开始于
2026-10-17 21:40
结束于
2026-10-31 21:40
持续时间
336 小时
主持人
参赛人数
55