結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー yuly3yuly3
提出日時 2020-01-30 02:57:15
言語 Nim
(2.0.2)
結果
AC  
実行時間 275 ms / 5,000 ms
コード長 402 bytes
コンパイル時間 4,667 ms
コンパイル使用メモリ 68,588 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-15 22:21:28
合計ジャッジ時間 7,215 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 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,376 KB
testcase_07 AC 275 ms
4,380 KB
testcase_08 AC 228 ms
4,376 KB
testcase_09 AC 157 ms
4,380 KB
testcase_10 AC 189 ms
4,380 KB
testcase_11 AC 247 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 194 ms
4,376 KB
testcase_15 AC 256 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 59 ms
4,500 KB
testcase_18 AC 248 ms
4,380 KB
testcase_19 AC 30 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, math


proc solve() =
    var
        _ = stdin.readLine.parseInt
        A = stdin.readLine.strip.split.map(parseInt)
        dp: array[1 shl 15, 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