singh1495's blog

By singh1495, history, 3 years ago, In English

Given N stacks, each stack contains Si elements, find the maximum sum of the M numbers in the N stacks. To get the number of the stack, only supporting get the top number. For example, S=[1,200,1,2,3], if you want to get the number 200, you need choose 3,2,1 first. EX: S1=[1,1,100,3] S2=[2000,2,3,1] S3=[10,1,4] the maximum sum of the 3 numbers in the above stacks is 3+100+4=107. Any better solution for this problem?

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

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What are the constraints?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    1< N < 100 1< size of each stack < 100 1< M < 10000

»
3 years ago, # |
  Vote: I like it +4 Vote: I do not like it

https://codeforces.com/problemset/problem/148/E this problem is almost the same as the problem you presented and the solution idea is the same.