adarsh000321's blog

By adarsh000321, history, 3 weeks ago, In English,

In this spoj problem https://www.spoj.com/HSPLARCH/problems/HS08AKP/ constraints are bigger i.e., we cannot use 2D Knapsack so how else can we print the solutions in space optimized knapsack? Help would be greatly appreciated... :)

 
 
 
 
  • Vote: I like it
  • +8
  • Vote: I do not like it

»
13 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Still waiting for someone to answer... :(

»
13 days ago, # |
  Vote: I like it 0 Vote: I do not like it

let f[I] mean the best value with a total weight I. We can maintain g[I] which means the origin of f[I], so that i — g[I] is the weight of current item and f[I] — f[g[I]] is the value. Then let I become j, and do so.

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Oh I submitted your idea ... it got an ac on 2nd try... Thanks But i think the test cases are weak tooo...

»
12 days ago, # |
  Vote: I like it 0 Vote: I do not like it