Can we solve this problem the hard way?

Правка en3, от gagannagpal68, 2019-08-02 05:27:14

I was solving this problem(https://mirror.codeforces.com/contest/1197/problem/D) from a recent contest. Eventually, I came up with Dp. But in the process of solving, I proved if I can answer below problem then I can easily use that to solve the original problem.

Problem: Given an array of integers, We need to print an array sz[] of length n. sz[i] should print the value of maximum sum of i-length subarray. Example n = 3

given array:4 -2 5

ans: 5 3 7

Can we solve the problem in O(nlogn) ?

Теги #dp, standard algorithms, observation, education round 69, #math

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский gagannagpal68 2019-08-02 05:28:24 5 Tiny change: 'nExample\n\nn = 3\n' -> 'nExample\nn = 3\n'
en3 Английский gagannagpal68 2019-08-02 05:27:14 2 Tiny change: '\nn = 3\ngiven ar' -> '\nn = 3\n\ngiven ar'
en2 Английский gagannagpal68 2019-08-02 05:26:58 8
en1 Английский gagannagpal68 2019-08-02 05:26:01 541 Initial revision (published)