結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー nanaenanae
提出日時 2017-02-10 12:28:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,409 ms / 5,000 ms
コード長 594 bytes
コンパイル時間 1,304 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 259,940 KB
最終ジャッジ日時 2023-09-12 11:11:26
合計ジャッジ時間 22,189 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
77,456 KB
testcase_01 AC 83 ms
77,884 KB
testcase_02 AC 86 ms
80,076 KB
testcase_03 AC 86 ms
79,576 KB
testcase_04 AC 81 ms
77,636 KB
testcase_05 AC 87 ms
80,228 KB
testcase_06 AC 81 ms
78,392 KB
testcase_07 AC 3,409 ms
256,132 KB
testcase_08 AC 2,269 ms
259,924 KB
testcase_09 AC 1,596 ms
259,184 KB
testcase_10 AC 1,912 ms
259,940 KB
testcase_11 AC 2,385 ms
259,336 KB
testcase_12 AC 89 ms
80,584 KB
testcase_13 AC 80 ms
76,720 KB
testcase_14 AC 1,044 ms
258,956 KB
testcase_15 AC 2,449 ms
258,936 KB
testcase_16 AC 85 ms
79,440 KB
testcase_17 AC 771 ms
259,612 KB
testcase_18 AC 2,851 ms
259,940 KB
testcase_19 AC 461 ms
203,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    As = [int(i) for i in input().split()]
    dp = [[False]*(2**15) for i in range(2)]
    dp[0][0] = True

    for a in As:
        for j in range(2**15):
            if dp[0][j] == True:
                dp[1][j] = True
                dp[1][a ^ j] = True
        dp[0] = dp[1][:]

    ans = sum(i for i in dp[1][:])

    print(ans)

if __name__ == '__main__':
    solve()
0