Files
python/TangDou/AcWing/GameTheory/894.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

35 lines
634 B
C++

#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n;
int f[N];
int res;
int sg(int x) {
if (~f[x]) return f[x];
unordered_set<int> S;
// 所有能到的局面
for (int i = 0; i < x; i++)
for (int j = 0; j <= i; j++)
S.insert(sg(i) ^ sg(j));
for (int i = 0;; i++)
if (!S.count(i)) return f[x] = i;
}
int main() {
// 初始化
memset(f, -1, sizeof f);
cin >> n;
while (n--) {
int x;
cin >> x;
res ^= sg(x);
}
if (res)
puts("Yes");
else
puts("No");
return 0;
}