結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー fine
提出日時 2016-04-02 01:08:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 1,519 ms
コンパイル使用メモリ 161,592 KB
実行使用メモリ 10,784 KB
最終ジャッジ日時 2024-07-04 12:12:34
合計ジャッジ時間 26,662 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 2 WA * 9 TLE * 2 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, ans = 0, c;
    unsigned long long tmp;
    cin >> n;
    vector<unsigned long long> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        if(a[i]) {
            ans++;
            tmp = a[i];
            c = -1;
            while (tmp >>= 1LL) c++;
            for(int j = i + 1; j < n; j++) {
                if ((1LL << c) & a[j]) a[j] ^= a[i];
            }
        }
    }
    cout << (1LL << ans) << "\n";
    return 0;
}
0