結果

問題 No.2538 2進元ゲーム
ユーザー momoyuumomoyuu
提出日時 2023-11-10 22:09:56
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 4,693 ms
コンパイル使用メモリ 258,884 KB
実行使用メモリ 18,580 KB
最終ジャッジ日時 2023-11-10 22:10:08
合計ジャッジ時間 9,568 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
6,676 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 433 ms
6,676 KB
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0