# Problem Link:

Author: ponder

Problem Link: Click here

# Difficulty:

Beginner

# Problem:

Given an array if we can reduce an element of an array by the amount of its index, check if it is possible to make the sum of array 0.

# Explanation:

As we can only reduce the sum if the initial sum is less than 0 then the answer is NO.

We can reduce value of a[i] by i and the range of i is from 1 .... n. If we observe carefully, it is always possible to make the sum in between 1 ...... n * (n + 1)/2 by taking a combination of N indices.

Consider it line this to make sum N + 1 we will add 1 to N.

for N + 2 we will add 2 to N.

and lastly for N * (N + 1)/2 we will add all 1, 2, .... N.

Hence if sum is \geq 0 and \leq N * (n + 1)/2 then answer will be YES.

# SOLUTION:

## Setter's Solution

```
void solve() {
int n;
cin >> n;
vl characterstics(n);
ipARR(characterstics,n);
ll curr_sum = 0;
FOR(i,n) curr_sum += characterstics[i];
ll sum_till_touka_can_recover = (ll)(n*(n+1))/2;
if(curr_sum >= 0 && curr_sum <= sum_till_touka_can_recover) cout << "YES\n";
else cout << "NO\n";
}
```