AT_abc479_c.Bento Packing

普及-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

共有 NN 道配菜。

第 ii 道配菜的美味度为 AiA_i,体积为 BiB_i。

你需要从中选择若干道配菜,使得所选配菜的总体积不超过 WW,并将它们装入一个便当盒中。

求所选配菜的最大可能总美味度。

输入格式

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

输入从标准输入中按以下格式给出:

NN WW
A1A_1 B1B_1
A2A_2 B2B_2
⋮\vdots
ANA_N BNB_N

输出格式

Output the answer.

输出答案。

输入输出样例

  • 输入#1

    4 13
    4 5
    3 3
    5 9
    8 6

    输出#1

    12
  • 输入#2

    3 99
    1 100
    10 100
    100 100

    输出#2

    0
  • 输入#3

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

    输出#3

    21

说明/提示

Sample 1 Explanation:
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.

Sample 2 Explanation:
You may also pack no 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.

样例 1 解释:
若将第 11 个和第 44 个配菜装入便当盒,则总美味度为 1212,总体积为 1111。

样例 2 解释:
你也可以不装入任何配菜。

约束条件

  • 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
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页