I encountered a problem in a programming competition a few weeks back, the problem was reducible to knapsack 0/1 problem.
But i couldn’t do it because the maximum weight was about 10^9, so in c++ i couldn’t use array. Although the number of items were about 10^5.
One way to solve this, that i could think of is using STL map, but not sure how to do this.
Any help would be appreciated. Thank You.
If all you need is a huge array, why don’t you break it down to smaller ones?
I hope it does not have any typos.
Usage:
If you need bigger values for value, you can make
vector<int>tovector<long>orvector<double>or whatever inHuge_array.