Interval Addition
시간 제한4초메모리 제한2048 MB
수열이 주어질 때, 연속한 구간에 실수를 더하는 연산만으로 모든 원소를 0으로 만드는 최소 연산 횟수를 구한다.
문제
You are given an array of integers. You can perform operations on this array. In a single operation, you can add any real number to some consecutive interval of .
Determine the minimum number of operations that have to be performed to make all elements of equal to .
입력
The first line contains an integer ().
The second line contains the array ().
출력
Print a line with a single integer: the minimum number of operations needed.