Submit solution
Points:
5 (partial)
Time limit:
2.0s
Java
2.5s
Python
2.5s
Memory limit:
64M
Author:
Problem type
Roger has a list of
- The list
is sorted from least to greatest - All wildcards have the same value, which is a positive integer
Help Roger find out if this is possible. Output YES
if he can assign the wildcards a value so that NO
otherwise.
Constraints
If
Subtask 1 [30%]
Subtask 2 [30%]
Subtask 3 [40%]
Input Specification
The first line contains a single integer
The next line contains
Output Specification
Output a single string: YES
if it is possible and NO
otherwise.
Sample Input 1
Copy
6
0 0 1 5 5 5
Sample Output 1
Copy
YES
Explanation for Sample Output 1
The first two elements are wildcards. Setting them to
Sample Input 2
Copy
6
1 5 5 5 5 1
Sample Output 2
Copy
NO
Explanation for Sample 2
There are no wildcards, so Roger cannot do anything.
Sample Input 3
Copy
6
1 0 2 0 3 0
Sample Output 3
Copy
NO
Comments