結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー yuly3yuly3
提出日時 2020-01-30 02:52:26
言語 Nim
(2.0.2)
結果
AC  
実行時間 289 ms / 5,000 ms
コード長 406 bytes
コンパイル時間 4,685 ms
コンパイル使用メモリ 68,768 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-15 22:19:30
合計ジャッジ時間 7,587 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 289 ms
4,380 KB
testcase_08 AC 241 ms
4,376 KB
testcase_09 AC 166 ms
4,380 KB
testcase_10 AC 201 ms
4,380 KB
testcase_11 AC 261 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 208 ms
4,376 KB
testcase_15 AC 271 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 62 ms
4,376 KB
testcase_18 AC 263 ms
4,380 KB
testcase_19 AC 31 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, math


proc solve() =
    var
        _ = stdin.readLine.parseInt
        A = stdin.readLine.strip.split.map(parseInt)
        dp: array[2 shl 14 + 1, int]
    
    dp[0] = 1
    for a in A:
        var dp_tmp = dp
        for i in 0..<dp.len:
            if dp[i] == 1:
                dp_tmp[i xor a] = 1
        dp = dp_tmp
    echo sum(dp)


when is_main_module:
    solve()
0