'commit'
This commit is contained in:
35
TangDou/AcWing/GameTheory/894.cpp
Normal file
35
TangDou/AcWing/GameTheory/894.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user