## Mock CCC '18 Contest 3 S4 - A Graph Problem

View as PDF

Points: 10
Time limit: 0.6s
Memory limit: 1G

Problem type

Given an undirected weighted graph where there is an edge between every pair of distinct vertices of nonnegative integer weight, let be the sum of the weights of the edges incident on vertex .

Given a sequence of integers through , determine if it is possible to construct a graph of vertices such that for every vertex in the graph.

#### Constraints

There is no opportunity for partial credit on this problem.

#### Input Specification

The first line contains a single integer, .

Each of the next lines contains a single integer, through in order.

#### Output Specification

Output YES if it is possible to construct such a graph. Output NO otherwise.

#### Sample Input 1

3
1
1
2

#### Sample Output 1

YES

#### Sample Input 2

3
1
1
3

#### Sample Output 2

NO

## Comments

• commented on Dec. 8, 2019, 6:34 p.m. edited

It doesnt make sense if you only have one node but you cannot make a graph