結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー magurogumamaguroguma
提出日時 2017-08-13 00:43:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-10-13 06:04:33
合計ジャッジ時間 1,410 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 7 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
#B = []
#for a in A:
#    B.append(format(a, '015b'))

#X = 0
dp = [False] * (pow(2,14)+1)
dp[0] = True

def solution(i, m):
#    if dp[m^A[i]]:
#        return dp[m^A[i]]
#    dp[m^A[i]] = True
    if i<N-1:
        if not dp[m]:
            solution(i+1, m)
        elif not dp[m^A[i]]:
            solution(i+1, m^A[i])
    dp[m] = True
    dp[m^A[i]] = True

solution(0, 0)

pattern = 0
for b in dp:
    if b:
        pattern += 1

print(pattern)
0