結果

問題 No.2538 2進元ゲーム
ユーザー GOTKAKOGOTKAKO
提出日時 2023-11-10 23:11:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,224 bytes
コンパイル時間 2,526 ms
コンパイル使用メモリ 209,456 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-10 23:11:17
合計ジャッジ時間 4,278 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 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 WA -
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 WA -
testcase_15 WA -
testcase_16 WA -
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 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
6,676 KB
testcase_24 WA -
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 WA -
testcase_28 AC 2 ms
6,676 KB
testcase_29 AC 2 ms
6,676 KB
testcase_30 AC 8 ms
6,676 KB
testcase_31 AC 61 ms
6,676 KB
testcase_32 AC 122 ms
6,676 KB
testcase_33 AC 124 ms
6,676 KB
testcase_34 AC 74 ms
6,676 KB
testcase_35 AC 73 ms
6,676 KB
testcase_36 AC 51 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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(minus) cout << 1 << endl;
    else if(xora != 0) cout << 1 << endl;
    else cout << 2 << endl;
    
}
0