### PROBLEM LINK:

**Author:** Sergey Nagin

**Tester:** Shiplu Hawlader

**Editorialist:** Lalit Kundu

### DIFFICULTY:

EASY-MEDIUM

### PRE-REQUISITES:

Maths

### PROBLEM:

Sereja conducted a voting about **N** of his opinions. **A _{i}** percent of people voted for opinion number

**i**. This statistics is called valid if sum of all

**A**is equal to

_{i}**100**.

Now let us define rounding up of a statistics **A**.

- If
**A**is not an integer, it will be rounded up to next integer._{i} - Otherwise it will be left as it is.

Now let us consider a statistics **B** of size **N** in which each of **B _{i}** is an integer. Now he wants to know whether there exists some valid statistic

**A**of size

**N**(may contain real numbers) such that after rounding it up, it becomes same as

**B**?

1 ā¤ N ā¤ 10000

### EXPLANATION:

Letās define a small positive infinitesimal quantity **e**(epsilon).

For **B _{i}**, corresponding element in array

**A**can be in range [

**B**-1+

_{i}**e**,

**B**](both ranges included).

_{i}However,

**B**= 0, the above range is invalid, so weāll ignore all zero elements. Letās say size of the remaining array

_{i}**B**(after removing 0s) is

**N**.

We now consider the lower and upper bounds on the sum of all numbers in

**A**(note: any real number between these bounds can be generated). So, if 100 lies within these bounds, then answer is yes.

#### LOWER BOUND:

Now, what is the minimum possible sum? Itās **S** = [sum over all **B _{i}**] -

**N**(number of non-negative elements in

**B**) +

**e**. So, we get condition for validity that

**S ā¤ 100**. If we ignore the

**e**, we get

**S**= [sum over all

**B**] -

_{i}**N**(number of non-negative elements in

**B**) < 100.

#### UPPER BOUND:

Now, what is the maximum possible sum? Itās **S** = sum over all **B _{i}**. So, we get one more validity condition that

**S ā„ 100**.

Complexity: **O(N)**.

### SOLUTIONS:

Setterās solution

Testerās solution

Note: Some people were confused about bounds on array A. A was not even in input.