結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2022-12-26 04:32:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 887 bytes
コンパイル時間 1,210 ms
コンパイル使用メモリ 112,452 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 14:32:09
合計ジャッジ時間 4,731 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 87 ms
6,940 KB
testcase_09 AC 20 ms
6,944 KB
testcase_10 AC 67 ms
6,944 KB
testcase_11 AC 48 ms
6,940 KB
testcase_12 AC 101 ms
6,940 KB
testcase_13 AC 110 ms
6,940 KB
testcase_14 AC 64 ms
6,940 KB
testcase_15 AC 119 ms
6,940 KB
testcase_16 AC 98 ms
6,940 KB
testcase_17 AC 107 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 31 ms
6,944 KB
testcase_21 AC 122 ms
6,940 KB
testcase_22 AC 123 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 74 ms
6,944 KB
testcase_29 AC 104 ms
6,944 KB
testcase_30 AC 92 ms
6,944 KB
testcase_31 AC 79 ms
6,940 KB
testcase_32 AC 98 ms
6,944 KB
testcase_33 AC 120 ms
6,940 KB
testcase_34 AC 118 ms
6,944 KB
testcase_35 AC 122 ms
6,944 KB
testcase_36 AC 121 ms
6,940 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<<i & A[j]) A[j] ^= A[rank];
            }
            rank++;
        }
    }

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

    return 0;
}

0