結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー magurogumamaguroguma
提出日時 2017-08-13 02:14:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 604 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,032 KB
最終ジャッジ日時 2024-04-21 07:21:20
合計ジャッジ時間 1,594 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
11,136 KB
testcase_01 AC 36 ms
10,880 KB
testcase_02 AC 41 ms
11,008 KB
testcase_03 AC 37 ms
11,008 KB
testcase_04 AC 38 ms
10,880 KB
testcase_05 AC 43 ms
10,880 KB
testcase_06 AC 37 ms
10,880 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 49 ms
11,008 KB
testcase_13 AC 38 ms
11,136 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 36 ms
11,136 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 44 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

    # dp = [False] * 40000
    dp = []
    for i in range(40000):
        dp.append(False)

    solution(0, 0, dp, A, N)
    pattern = 0
    for b in dp:
        if b:
            pattern += 1
    print(pattern)
0