Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Divide array into K segments with max sum (N,K <= 2e5)

Правка en1, от drdilyor, 2023-02-10 07:47:05

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

Теги dp, problem

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский drdilyor 2023-02-10 07:48:29 65
en1 Английский drdilyor 2023-02-10 07:47:05 460 Initial revision (published)