Knapsack

Prize
€1,000
Time
39 days left

Choose items with a total weight under the capacity and the maximum total value.

Submission

One Python file solve.py (standard library only, no network). It reads instance.json from the current directory:

{"capacity": 120, "weights": [12, 40, 7], "values": [30, 55, 9]}

and prints the list of chosen item indices as JSON on its last output line, for example [0, 2]. Each instance has a limit of 20 seconds.

Example instance: example.json

Score

Sum of the values on the hidden instances. An instance with a wrong or infeasible answer gives 0.

Submit

Limit: 5 per day

Login to submit