結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2022-12-26 04:30:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 890 bytes
コンパイル時間 1,084 ms
コンパイル使用メモリ 109,964 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-12 19:27:13
合計ジャッジ時間 5,768 ms
ジャッジサーバーID
(参考情報)
judge15 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 84 ms
4,376 KB
testcase_09 AC 19 ms
4,380 KB
testcase_10 AC 65 ms
4,380 KB
testcase_11 AC 47 ms
4,380 KB
testcase_12 AC 98 ms
4,380 KB
testcase_13 AC 106 ms
4,376 KB
testcase_14 AC 61 ms
4,376 KB
testcase_15 AC 114 ms
4,376 KB
testcase_16 AC 97 ms
4,376 KB
testcase_17 AC 102 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 26 ms
4,376 KB
testcase_21 AC 118 ms
4,376 KB
testcase_22 AC 118 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 71 ms
4,376 KB
testcase_29 AC 100 ms
4,376 KB
testcase_30 AC 86 ms
4,380 KB
testcase_31 AC 74 ms
4,376 KB
testcase_32 AC 93 ms
4,376 KB
testcase_33 AC 115 ms
4,380 KB
testcase_34 AC 114 ms
4,380 KB
testcase_35 AC 117 ms
4,376 KB
testcase_36 AC 117 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;

int main(){

    long long N, rank=0;
    cin >> N;
    deque<long long> A(N);
    for (int i=0; i<N; i++) cin >> A[i];

    for (int i=0; i<=60; i++){
        bool f=0;
        if (1LL<<i & A[rank]) f = 1;
        else{
            for (int j=rank+1; j<N; j++){
                if (1LL<<i & A[j]){
                    swap(A[rank], A[j]);
                    f = 1;
                    break;
                }
            }
        }
        if (f){
            for (int j=rank+1; j<N; j++){
                if (1LL<<rank & A[j]) A[j] ^= A[rank];
            }
            rank++;
        }
    }

    cout << (1LL<<rank) << endl;

    return 0;
}

0