結果

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

テストケース

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

ソースコード

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);
    for(int i=1; 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;
            if(ap == now) now++;
        }
        grundy.at(i) = now;
    }
    
    int minus = 0,xora = 0,plus = 0;
    for(int i=0; i<N; i++){
        long long a = A.at(i);
        if(a < 0){minus++; continue;}
        if(a == 0) continue;

        plus++;
        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;
            if(ap == now) now++;
        }
        xora ^= now;
        cout << a << " " << now << endl;
    }
    if(xora == 0 && minus%2 == 0) cout << 2 << endl;
    else cout << 1 << endl;
}
0