結果
問題 |
No.2538 2進元ゲーム
|
ユーザー |
|
提出日時 | 2023-11-10 23:21:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,197 bytes |
コンパイル時間 | 1,725 ms |
コンパイル使用メモリ | 199,620 KB |
最終ジャッジ日時 | 2025-02-17 21:27:35 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<long long> A(N); for(auto &a : A) cin >> a; vector<long long> grundy(61); grundy.at(1) = 1; for(int i=2; i<=60; i++){ vector<int> appear; for(int k=0; k<6; k++){ if(i&(1<<k)) appear.push_back(grundy.at(k)); } sort(appear.begin(),appear.end()); int now = 0; for(auto ap : appear){ if(ap != now) break; now++; } grundy.at(i) = now; } int minus = 0,xora = 0; for(int i=0; i<N; i++){ long long a = A.at(i); if(a < 0){minus++; continue;} if(a <= 60){xora ^= grundy.at(a); continue;} vector<int> appear; for(int k=0; k<60; k++){ if(a&(1LL<<k)) appear.push_back(grundy.at(k)); } sort(appear.begin(),appear.end()); int now = 0; for(auto ap : appear){ if(ap != now) break; now++; } xora ^= now; } if(xora == 0 && minus%2 == 0) cout << 2 << endl; else cout << 1 << endl; }