結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kokatsukokatsu
提出日時 2021-12-14 23:07:26
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 178 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 207,256 KB
実行使用メモリ 5,772 KB
最終ジャッジ日時 2023-09-04 15:20:08
合計ジャッジ時間 4,402 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 178 ms
4,600 KB
testcase_08 AC 155 ms
4,620 KB
testcase_09 AC 107 ms
4,620 KB
testcase_10 AC 129 ms
4,592 KB
testcase_11 AC 167 ms
4,564 KB
testcase_12 AC 3 ms
5,772 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 174 ms
4,632 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 41 ms
4,564 KB
testcase_18 AC 164 ms
4,612 KB
testcase_19 AC 21 ms
4,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int N;
    readf("%d\n", N);

    auto A = readln.chomp.split.to!(int[]);

    int lim = A.maxElement * 2 + 1;
    
    auto list = new bool[](lim);
    list[0] = true;
    foreach (a; A) {
        auto tmp = list.dup;
        foreach (i; 0 .. lim) {
            if (!list[i]) {
                continue;
            }

            tmp[a^i] = true;
        }
        list = tmp;
    }

    list.count(true).writeln;
}
0