結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー nanae
提出日時 2017-02-10 12:28:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,972 ms / 5,000 ms
コード長 594 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 259,820 KB
最終ジャッジ日時 2024-06-29 23:45:46
合計ジャッジ時間 18,414 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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