結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー YS55749378YS55749378
提出日時 2022-03-30 13:01:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 465 ms / 5,000 ms
コード長 916 bytes
コンパイル時間 1,859 ms
コンパイル使用メモリ 169,548 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 21:35:33
合計ジャッジ時間 11,616 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 354 ms
5,376 KB
testcase_09 AC 61 ms
5,376 KB
testcase_10 AC 246 ms
5,376 KB
testcase_11 AC 164 ms
5,376 KB
testcase_12 AC 377 ms
5,376 KB
testcase_13 AC 409 ms
5,376 KB
testcase_14 AC 224 ms
5,376 KB
testcase_15 AC 452 ms
5,376 KB
testcase_16 AC 365 ms
5,376 KB
testcase_17 AC 398 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 24 ms
5,376 KB
testcase_21 AC 465 ms
5,376 KB
testcase_22 AC 463 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 266 ms
5,376 KB
testcase_29 AC 377 ms
5,376 KB
testcase_30 AC 317 ms
5,376 KB
testcase_31 AC 278 ms
5,376 KB
testcase_32 AC 343 ms
5,376 KB
testcase_33 AC 440 ms
5,376 KB
testcase_34 AC 444 ms
5,376 KB
testcase_35 AC 463 ms
5,376 KB
testcase_36 AC 464 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#define REP2(i,m,n) for(long i=(long)m;i<(long)n;++i)
#define REP(i,n) REP2(i,0,n)

void yesno(bool flag){
    cout<<(flag?"Yes":"No")<<endl;
}

vector<long> binary_xor_elimination(long v[],long n){
    sort(v,v+n);
    reverse(v,v+n);
    vector<long> res;
    REP(i,n){
        long b=63;
        while(b>=0 && ((1LL<<b & v[i])==0)) b--;
        if(b!=-1){
            res.push_back(b);
            REP2(j,i+1,n){
                if(1LL<<b & v[j]) v[j]^=v[i];
            }
            sort(v+i+1,v+n);
            reverse(v+i+1,v+n);
        }
    }
    return res;
}

int main(){
    long n;
    cin>>n;
    long a[n];
    REP(i,n) cin>>a[i];
    vector<long> res=binary_xor_elimination(a,n);
    long l=res.size();
    cout<<(1LL<<l)<<endl;
    return 0;
}
0