結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー kimiyukikimiyuki
提出日時 2017-02-25 01:22:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 374 ms / 5,000 ms
コード長 908 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 74,940 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 17:41:32
合計ジャッジ時間 8,491 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 265 ms
4,376 KB
testcase_09 AC 56 ms
4,376 KB
testcase_10 AC 202 ms
4,380 KB
testcase_11 AC 145 ms
4,376 KB
testcase_12 AC 308 ms
4,376 KB
testcase_13 AC 333 ms
4,380 KB
testcase_14 AC 191 ms
4,376 KB
testcase_15 AC 362 ms
4,380 KB
testcase_16 AC 301 ms
4,380 KB
testcase_17 AC 325 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 22 ms
4,380 KB
testcase_21 AC 373 ms
4,376 KB
testcase_22 AC 374 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 222 ms
4,376 KB
testcase_29 AC 313 ms
4,380 KB
testcase_30 AC 265 ms
4,380 KB
testcase_31 AC 228 ms
4,376 KB
testcase_32 AC 284 ms
4,380 KB
testcase_33 AC 362 ms
4,376 KB
testcase_34 AC 358 ms
4,376 KB
testcase_35 AC 370 ms
4,380 KB
testcase_36 AC 368 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using namespace std;
uint64_t bit(int i) { return 1ull << i; }
void add(vector<uint64_t> & xs, uint64_t y) {
    for (uint64_t x : xs) {
        repeat_reverse (i,64) {
            if (not (x & bit(i)) and not (y & bit(i))) continue;
            if ((x & bit(i)) and (y & bit(i))) y ^= x;
            break;
        }
    }
    if (y) {
        xs.push_back(y);
        whole(sort, xs);
        whole(reverse, xs);
    }
}
int main() {
    int n; cin >> n;
    vector<uint64_t> acc;
    repeat (i,n) {
        uint64_t a; cin >> a;
        add(acc, a);
    }
    cout << (1ll << acc.size()) << endl;
    return 0;
}
0