結果

問題 No.184 たのしい排他的論理和(HARD)
コンテスト
ユーザー zelda_master
提出日時 2026-10-21 01:12:00
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 35 ms / 5,000 ms
+ 958µs
コード長 766 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 366 ms
コンパイル使用メモリ 73,868 KB
実行使用メモリ 8,240 KB
最終ジャッジ日時 2026-10-21 01:12:27
合計ジャッジ時間 5,458 ms
ジャッジサーバーID
(参考情報)
judge6_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

const int N = 100010, B = 70;

LL a[N];
int n, rnk;

struct LinearBasis {
    LL v[B];
    void Insert(LL x) {
        for (int i = B - 1; i >= 0; --i) {
            if (x >> i & 1) {
                if (v[i]) {
                    x ^= v[i];
                } else {
                    v[i] = x;
                    ++rnk;
                    return;
                }
            }
        }
    }
};
LinearBasis lb;

int main() {
    // freopen("int.in", "r", stdin);
    // freopen("int.out", "w", stdout);

    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%lld", &a[i]);
        lb.Insert(a[i]);
    }

    printf("%lld\n", 1LL << rnk);

    return 0;
}
0