SG(a, b) = SG(a) ^ SG(b);

- #include
- #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- #define endl '\n'
-
- using namespace std;
-
- typedef pair<int, int> PII;
- typedef long long ll;
- typedef long double ld;
-
- const int N = 110, M = 10010;
-
- int sg[N];
-
- int main()
- {
- IOS
-
- for(int i = 1; i <= 100; i ++)
- {
- unordered_set<int> S;
- for(int u1 = 0; u1 < i; u1 ++)
- {
- for(int u2 = 0; u2 <= u1; u2 ++)
- {
- S.insert(sg[u1] ^ sg[u2]);
- }
- }
- for(int j = 0; ; j ++)
- {
- if(!S.count(j))
- {
- sg[i] = j;
- break;
- }
- }
- }
-
- int n, res = 0;
- cin >> n;
- for(int i = 0; i < n; i ++)
- {
- int x;
- cin >> x;
- res ^= sg[x];
- }
-
- if(res)cout << "Yes";
- else cout << "No";
-
- return 0;
- }