結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kimiyukikimiyuki
提出日時 2016-07-30 20:50:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 5,000 ms
コード長 675 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 72,988 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 01:06:27
合計ジャッジ時間 2,626 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 150 ms
4,376 KB
testcase_08 AC 148 ms
4,376 KB
testcase_09 AC 102 ms
4,380 KB
testcase_10 AC 120 ms
4,376 KB
testcase_11 AC 160 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 137 ms
4,380 KB
testcase_15 AC 164 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 37 ms
4,376 KB
testcase_18 AC 145 ms
4,376 KB
testcase_19 AC 19 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) y) { return (f)(begin(y), end(y), ## __VA_ARGS__); })(x)
using namespace std;
const int l = 15;
int main() {
    int n; cin >> n;
    vector<int> as(n); repeat (i,n) cin >> as[i];
    array<bool,(1<<l)> cur = {};
    array<bool,(1<<l)> prv = {};
    cur[0] = true;
    for (int a : as) {
        cur.swap(prv);
        repeat (i,1<<l) if (prv[i]) {
            cur[i  ] = true;
            cur[i^a] = true;
        }
    }
    int ans = whole(count, cur, true);
    cout << ans << endl;
    return 0;
}
0