AtCoder Grand Contest 010
翻译中…
Problem Statement
翻译中…
There are $N$ boxes arranged in a circle. The $i$-th box contains $A_i$ stones.
翻译中…
Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:
翻译中…
- Select one box. Let the box be the
$i$-th box. Then, for each$j$from$1$through$N$, remove exactly$j$stones from the$(i+j)$-th box. Here, the$(N+k)$-th box is identified with the$k$-th box.
翻译中…
Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
翻译中…
Constraints
翻译中…
$1 ≦ N ≦ 10^5$$1 ≦ A_i ≦ 10^9$
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N
A_1 A_2 … A_N
翻译中…
Output
翻译中…
If it is possible to remove all the stones from the boxes, print YES. Otherwise, print NO.
翻译中…
样例
Input #1
5
4 5 1 2 3
Output #1
YES
All the stones can be removed in one operation by selecting the second box.
Input #2
5
6 9 12 10 8
Output #2
YES
Input #3
4
1 2 3 1
Output #3
NO
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。