Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

IMAN_GH's blog

By IMAN_GH, history, 6 years ago, In English

Consider array A with n elements.
In one operation you can decrease A[i] and increase A[i+1] (i < n & A[i] > 0).
g(A) equals the minimum number of operations to make array A non-decreasing.

Subtasks :

-- n <= 800 , 0 <= A[i] <= 10^3 , g(A) is required.
-- n <= 10^4 , 0 <= A[i] <= 10^12 , g(A) is required.

-- n <= 800 , 0 <= A[i] <= 10^12 , The sum of g for all A substrings is required.
-- n <= 10^4 , 0 <= A[i] <= 10^12 , The sum of g for all A substrings is required.

All of them mod 10^9 + 7.

(This problem prepared for CodeShark#4)

Read more »

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