How to solve this problem?

Правка en2, от Destopia, 2022-08-16 20:52:56

Given an array of non-positive integers of length $$$n$$$ $$$(1 \leq n \leq 10^5)$$$ i.e. $$$a_i \leq 0$$$. $$$(-10^9 \leq a_i \leq 0)$$$ We want to make all elements equal to $$$0$$$. We can do the following operation any number of times (possibly zero).

Choose any subarray and increase all its elements by $$$1$$$.

What is the minimum number of operations to make all elements equal to $$$0$$$?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Destopia 2022-08-16 20:55:21 99 Tiny change: 'Output\n\n3\n\n\n\n\n' -> 'Output\n\n~~~~~\n\n3\n~~~~~\n\n\n\n\n\n\n'
en2 Английский Destopia 2022-08-16 20:52:56 17
en1 Английский Destopia 2022-08-16 20:49:31 416 Initial revision (published)