您的位置:首页 > 其它

Educational Codeforces Round 33 (Rated for Div. 2) A - Chess For Three

2017-11-24 22:15 429 查看
手动模拟

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<map>
#define PI acos(-1.0)
#define in freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 100 + 7, maxd = 670000 + 7;
const ll mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;

int main() {
ios::sync_with_stdio(0);

int n, x;
int a, b, c;
cin >> n ;
a = 1; b = 2; //c = 3;
for(int i = 0; i < n; ++i) {
cin >> x;
if(x == 1) {
if(a == 1) {
b = 5 - b;
}
else if(b == 1) {
a = 5 - a;
}
else return puts("NO")*0;
}
else if(x == 2) {
if(a == 2) {
b = 4 - b;
}
else if(b == 2) {
a = 4 - a;
}
else return puts("NO")*0;
}
else if(x == 3) {
if(a == 3) {
b = 3 - b;
}
else if(b == 3) {
a = 3 - a;
}
else return puts("NO")*0;
}
}
puts("YES");

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: