ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1005. Stone Pile

DP with O(n*max(wi)) time and O(max(n, max(wi))) space
Posted by Серовиков Андрей 30 Apr 2013 02:58
There is a DP solution for this version of knapsack problem with O(n*max(wi)) time and O(max(n, max(wi))) space. It's a beat tricky, but still not so difficult in implementation. Just use your brains wisely ;)

But an easy one is a brute-force, where we need to search between 2^n sets of piles.

P.S. To admins, how about adding a new problem "Stone Pile 2" with N<=1000, 1<=Wi<=10000 and with writing the exact piles to output :)