drdilyor's blog

By drdilyor, history, 21 month(s) ago, In English

I haven't been able to solve this problem for a long time (10 months), so I would greatly appreciate anyone can solve it or can provide hints.

For $$$ N, K \le 2*10^3 $$$ subtask we can use a straightforward DP, but I have no idea for DP optimization or Greedy algorithm for $$$ N, K \le 2*10^5 $$$ full task.

Examples:

6 2
2 -1 3 -4 -2 6

Answer: segments [1, 3] and [6, 6] with sum 10. No need to output which segments are used, just the sum itself.

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

»
21 month(s) ago, # |
  Vote: I like it +23 Vote: I do not like it
Spoiler
  • »
    »
    21 month(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, man, I didn't quite understand them but I will read them everyday and look for the day when I finally get it :,). Also, NOI 2019 turns out to be exactly the same problem.