結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
18,432 KB
testcase_01 AC 94 ms
18,432 KB
testcase_02 AC 100 ms
18,432 KB
testcase_03 AC 98 ms
18,524 KB
testcase_04 AC 98 ms
18,476 KB
testcase_05 AC 96 ms
18,560 KB
testcase_06 AC 99 ms
18,304 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 108 ms
18,432 KB
testcase_13 AC 96 ms
18,560 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 95 ms
18,432 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 105 ms
18,816 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

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

    dp = [False] * 1000000

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

0