結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kiccho1101kiccho1101
提出日時 2022-04-23 18:44:25
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 370 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 86,740 KB
実行使用メモリ 839,800 KB
最終ジャッジ日時 2023-09-07 11:10:34
合計ジャッジ時間 6,157 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
79,508 KB
testcase_01 AC 104 ms
81,776 KB
testcase_02 AC 130 ms
87,272 KB
testcase_03 AC 121 ms
85,724 KB
testcase_04 AC 96 ms
80,176 KB
testcase_05 AC 135 ms
88,040 KB
testcase_06 AC 111 ms
82,540 KB
testcase_07 MLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

# dp[i][j]:  i番目までの数字でjにできるかどうか
dp = [[False] * (10 ** 5 + 1) for _ in range(N + 1)]

dp[0][0] = True
for i in range(N):
    for j in range(10 ** 5 + 1):
        dp[i + 1][j] = dp[i][j]
        if j ^ A[i] < 10 ** 5 + 1:
            dp[i + 1][j] |= dp[i][j ^ A[i]]

print(sum(dp[N]))
0