結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー solzardsolzard
提出日時 2019-08-07 14:12:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 777 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,752 KB
実行使用メモリ 76,920 KB
最終ジャッジ日時 2023-09-15 12:29:03
合計ジャッジ時間 6,843 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,464 KB
testcase_01 AC 78 ms
75,552 KB
testcase_02 AC 80 ms
75,728 KB
testcase_03 AC 76 ms
75,796 KB
testcase_04 AC 75 ms
75,420 KB
testcase_05 AC 78 ms
75,840 KB
testcase_06 AC 78 ms
75,592 KB
testcase_07 AC 777 ms
76,852 KB
testcase_08 AC 610 ms
76,748 KB
testcase_09 AC 461 ms
76,516 KB
testcase_10 AC 528 ms
76,868 KB
testcase_11 AC 651 ms
76,692 KB
testcase_12 AC 78 ms
75,924 KB
testcase_13 AC 77 ms
75,460 KB
testcase_14 AC 80 ms
76,288 KB
testcase_15 AC 672 ms
76,764 KB
testcase_16 AC 78 ms
75,684 KB
testcase_17 AC 225 ms
76,920 KB
testcase_18 AC 687 ms
76,832 KB
testcase_19 AC 158 ms
76,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# No.183 たのしい排他的論理和(EASY)
# cf. AtCoder tdpcA - コンテスト
def main():
    _ = input()
    A = set(map(int, input().rstrip().split()))
    N = len(A)
    lim = 2 ** 15
    dp = [0] * (lim + 1)
    dp[0] = 1
    for i in A:
        for j in range(lim, -1, -1):
            if i == j:
                dp[i] = 1
            elif dp[j]:
                dp[i ^ j] = 1
    print(sum(dp))


if __name__ == "__main__":
    main()
0