結果
| 問題 |
No.2538 2進元ゲーム
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2023-11-10 22:09:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 636 bytes |
| コンパイル時間 | 3,011 ms |
| コンパイル使用メモリ | 257,400 KB |
| 実行使用メモリ | 17,152 KB |
| 最終ジャッジ日時 | 2024-09-26 01:39:01 |
| 合計ジャッジ時間 | 7,661 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 WA * 5 TLE * 1 -- * 5 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
map<ll,ll> memo,vis;
ll calc(ll ni){
if(vis[ni]) return memo[ni];
vector<int> use;
for(int i = 0;i<=63;i++){
if(ni>>i&1) use.push_back(calc(i));
}
sort(use.begin(),use.end());
int now = 0;
for(int i = 0;i<use.size();i++){
if(now==use[i]) now++;
if(now<use[i]) break;
}
return memo[ni] = now;
}
int main(){
int n;
cin>>n;
vector<ll> a(n);
for(int i = 0;i<n;i++) cin>>a[i];
ll now = 0;
for(int i = 0;i<n;i++) now ^= calc(a[i]);
if(now==0) cout<<2<<endl;
else cout<<1<<endl;
}
momoyuu