結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kiccho1101kiccho1101
提出日時 2022-04-23 18:49:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 4,550 ms / 5,000 ms
コード長 357 bytes
コンパイル時間 1,953 ms
コンパイル使用メモリ 86,548 KB
実行使用メモリ 260,116 KB
最終ジャッジ日時 2023-09-07 11:13:00
合計ジャッジ時間 35,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
77,000 KB
testcase_01 AC 79 ms
77,592 KB
testcase_02 AC 88 ms
79,580 KB
testcase_03 AC 89 ms
79,056 KB
testcase_04 AC 77 ms
77,252 KB
testcase_05 AC 89 ms
80,036 KB
testcase_06 AC 82 ms
78,168 KB
testcase_07 AC 4,550 ms
259,920 KB
testcase_08 AC 4,011 ms
259,940 KB
testcase_09 AC 2,865 ms
260,116 KB
testcase_10 AC 3,349 ms
259,936 KB
testcase_11 AC 4,357 ms
260,008 KB
testcase_12 AC 89 ms
80,080 KB
testcase_13 AC 74 ms
76,436 KB
testcase_14 AC 3,932 ms
259,888 KB
testcase_15 AC 4,489 ms
260,068 KB
testcase_16 AC 85 ms
79,072 KB
testcase_17 AC 1,129 ms
259,952 KB
testcase_18 AC 4,235 ms
260,032 KB
testcase_19 AC 605 ms
214,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

M = 1 << 15

# dp[i][j]:  i番目までの数字でjにできるかどうか
dp = [False] * (M + 1)
dp[0] = True
for i in range(N):
    ndp = [False] * (M + 1)
    for j in range(M + 1):
        ndp[j] = dp[j]
        if j ^ A[i] < M + 1:
            ndp[j] |= dp[j ^ A[i]]
    dp = ndp

print(sum(dp))
0