Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Shopping

Lanran likes shopping! There are $n$ items in the shop, where each one has beauty $w_i$ and costs $c_i$ coins. Lanran has $m$ coins, and he wants to get the largest sum of beauty on items he can buy. Note that, Lanran can buy at most one per item.","The first line contains 2 integers $n,m$.

The second line contains $n$ integers $w_1,w_2,...,w_n$.

The third line contains $n$ integers $c_1,c_2,...,c_n$.","Output one integer, indicating the largest sum of beauty on items he can buy.

Sample input

3 6
5 3 3
3 2 4

Sample output

8

Limit

1 second for each test case. The memory limit is 256MB.

For 60% of the test cases, $1≤n,m≤100$.

For 100% of the test cases, $1≤n,m≤5000$.