結果
問題 | No.2538 2進元ゲーム |
ユーザー |
|
提出日時 | 2023-11-10 23:15:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 159 ms / 2,000 ms |
コード長 | 840 bytes |
コンパイル時間 | 4,341 ms |
コンパイル使用メモリ | 254,352 KB |
最終ジャッジ日時 | 2025-02-17 21:25:22 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 37 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using ll = long long;#define rep(i,n) for(int i=0;i<(int)(n);i++)int main(){int n;cin>>n;vector<ll> a(n);rep(i,n) cin>>a.at(i);// A034798vector<int> dp={0, 1, 0, 2, 1, 1, 2, 2, 0, 1, 0, 3, 1, 1, 3, 3, 0, 2, 0, 2, 2, 2, 2, 2, 0, 3, 0, 3, 3, 3, 3, 3, 0, 2, 0, 2, 2, 2, 2, 2, 0, 3, 0, 3, 3, 3, 3, 3, 0, 2, 0, 2, 2, 2, 2, 2, 0, 3, 0, 3, 3, 3, 3, 3, 0, 1, 0, 3, 1, 1, 3, 3, 0, 1, 0, 3, 1, 1, 3, 3, 0, 3, 0, 3, 3, 3, 3, 3, 0, 3, 0,3, 3, 3, 3, 3, 0, 3, 0, 3};int d=0;int smx=0;rep(i,n){if(a.at(i)<0){d++;continue;}set<int> st;rep(j,65){if((a.at(i)>>j)&1) st.insert(dp.at(j));}int mx=0;while(st.count(mx)) mx++;smx^=mx;}d%=2;if(d&&(smx==0)){cout<<"1\n";return 0;}if(smx) cout<<"1\n";else cout<<"2\n";}