All submissions for this problem are available.
The chef has decided to rob his enemies, when he's in his enemy's house, he's in a confusion as to which items to pick and which to drop, help him decide which items to pick based on the max profit they can generate, keep in mind the chef can carry only a little weight and not everything.
Line 1 of the input should contain the integer MAX denoting the maximum weight that can be carried.
Line 2 of the input should contain the number of items N
From line 3, the first n lines should contain the weight of N the items and the next N lines should contain the profits that these items can generate
The output should be the maximum profit that can be generated using the picked items.
The items can be fully or partially selected.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.