题目传送门
/*
题意:n个数字转盘,刚开始每个转盘指向一个数字(0~n-1,逆时针排序),然后每一次转动,奇数的+1,偶数的-1,问多少次使第i个数字转盘指向i-1
构造:先求出使第1个指向0要多少步,按照这个次数之后的能否满足要求
题目读的好累:(
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
int a[MAXN];
int main(void) //Codeforces Round #310 (Div. 2) B. Case of Fake Numbers
{
// freopen ("B.in", "r", stdin);
int n;
while (scanf ("%d", &n) == )
{
for (int i=; i<=n; ++i) scanf ("%d", &a[i]);
int cnt = ;
if (a[] != )
{
cnt = (n - ) - a[] + ;
}
bool flag = true;
for (int i=; i<=n; ++i)
{
if (i & )
{
for (int j=; j<=cnt; ++j)
{
a[i]++;
if (a[i] == n) a[i] = ;
}
if (a[i] != i - ) {flag = false; break;}
}
else
{
for (int j=; j<=cnt; ++j)
{
a[i]--;
if (a[i] == -) a[i] = n - ;
}
if (a[i] != i - ) {flag = false; break;}
}
}
(flag) ? puts ("Yes") : puts ("No");
}
return ;
}