結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー Eliza_0xEliza_0x
提出日時 2018-05-13 15:10:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 768 bytes
コンパイル時間 1,136 ms
コンパイル使用メモリ 66,964 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 18:51:25
合計ジャッジ時間 3,450 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 148 ms
4,376 KB
testcase_09 AC 101 ms
4,376 KB
testcase_10 AC 122 ms
4,380 KB
testcase_11 AC 159 ms
4,380 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 341 ms
4,376 KB
testcase_15 AC 165 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 39 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 20 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <bitset>
using namespace std;

int main() {
    const int size = 40000;
    int n; cin >> n;
    vector<int> ns(n);
    for (auto &&x: ns) cin >> x;
    bitset<size+1> memo;
    for (int y = 0; y<(n+1); y++) {
        for (int x = 0; x<16384+1; x++) {
            if      (y==0 && x==0) memo[x] = true;
            else if (y==0)         memo[x] = false;
            else memo[x] = memo[x] || (((x^ns[y-1]) < size) ? memo[x^ns[y-1]] : false);
        }
    }

    // for (int x = 0; x<25; x++) cout << setw(3) << x; cout << endl;
    // for (int x = 0; x<25; x++) cout << setw(3) << memo[x]; cout << endl;

    int cnt = 0;
    for (int x = 0; x<16384+1; x++) cnt += memo[x];
    cout << cnt << endl;
}
0