結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー ShibuyapShibuyap
提出日時 2021-02-20 00:08:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 107 ms / 5,000 ms
コード長 1,114 bytes
コンパイル時間 2,101 ms
コンパイル使用メモリ 206,052 KB
実行使用メモリ 4,884 KB
最終ジャッジ日時 2023-10-17 02:04:26
合計ジャッジ時間 7,330 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 76 ms
4,356 KB
testcase_09 AC 18 ms
4,348 KB
testcase_10 AC 58 ms
4,348 KB
testcase_11 AC 42 ms
4,348 KB
testcase_12 AC 88 ms
4,620 KB
testcase_13 AC 95 ms
4,620 KB
testcase_14 AC 55 ms
4,348 KB
testcase_15 AC 103 ms
4,884 KB
testcase_16 AC 86 ms
4,620 KB
testcase_17 AC 93 ms
4,620 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 20 ms
4,884 KB
testcase_21 AC 106 ms
4,884 KB
testcase_22 AC 107 ms
4,884 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 65 ms
4,356 KB
testcase_29 AC 90 ms
4,620 KB
testcase_30 AC 80 ms
4,356 KB
testcase_31 AC 69 ms
4,356 KB
testcase_32 AC 85 ms
4,620 KB
testcase_33 AC 103 ms
4,884 KB
testcase_34 AC 102 ms
4,884 KB
testcase_35 AC 106 ms
4,884 KB
testcase_36 AC 106 ms
4,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define srep(i,s,t) for(ll i = s; i < t; ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
using namespace std;
// using namespace atcoder;
typedef long long int ll;
typedef pair<ll,ll> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 500005

vector<ll> kitei(vector<ll> a){
    int n = a.size();
    int now = 0;
    for(int i = 62; i >= 0; i--){
        for(int j = now + 1; j < n; j++){
            if(a[j] & (1LL<<i)){
                swap(a[now], a[j]);
                break;
            }
        }
        if(!(a[now] & (1LL<<i))) continue;
        for(int j = 0; j < n; j++){
            if(j != now && (a[j] & (1LL<<i))) a[j] ^= a[now];
        }
        now++;
        if(now == n) break;
    }
    vector<ll> res;
    for(int i = 0; i < now; i++) res.push_back(a[i]);
    return res;
}

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
    vector<ll> v = kitei(a);

    int m = v.size();
    ll ans = 1LL << m;
    cout << ans << endl;
    return 0;
}


0