結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー なお
提出日時 2015-04-17 02:24:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 532 bytes
コンパイル時間 1,328 ms
コンパイル使用メモリ 157,724 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 11:19:26
合計ジャッジ時間 3,528 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
#define FOR(i, f, t)        for(int(i)=(f);(i)<(t);(++i))

ll N, A[111111];

int main(){
    do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0);
    cin >> N;
    REP(i,N) cin >> A[i];

    ll res = 1;
    REP(i,N){
        if(A[i] == 0) continue;
        res *= 2;
        ll x = 1LL << (64-__builtin_clzll(A[i])-1);
        FOR(j,i+1,N) if(A[j]&x) A[j] ^= A[i];
    }
    cout << res << endl;
}
0