結果
問題 |
No.2538 2進元ゲーム
|
ユーザー |
![]() |
提出日時 | 2023-11-24 12:19:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 923 bytes |
コンパイル時間 | 2,119 ms |
コンパイル使用メモリ | 199,904 KB |
最終ジャッジ日時 | 2025-02-17 23:37:16 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<int> grundy(64); for (int i = 1; i < 64; i++) { set<int> st; for (int j = 0; j < 64; j++) { if (i & (1LL << j)) { st.insert(grundy[j]); } } while (st.count(grundy[i])) { grundy[i]++; } } int ans = 0; for (int i = 0; i < n; i++) { set<int> st; for (int j = 0; j < 64; j++) { if (a[i] & (1LL << j)) { st.insert(grundy[j]); } } int tmp = 0; while (st.count(tmp)) { tmp++; } ans ^= tmp; } cout << (ans ? 1 : 2) << endl; }