結果

問題 No.1876 Xor of Sum
ユーザー kept1994kept1994
提出日時 2022-04-24 01:36:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 746 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 260,284 KB
最終ジャッジ日時 2023-09-07 16:54:49
合計ジャッジ時間 12,268 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,344 KB
testcase_01 AC 76 ms
71,548 KB
testcase_02 AC 72 ms
71,388 KB
testcase_03 AC 138 ms
79,464 KB
testcase_04 AC 287 ms
192,028 KB
testcase_05 AC 84 ms
77,360 KB
testcase_06 AC 455 ms
259,388 KB
testcase_07 AC 86 ms
77,412 KB
testcase_08 AC 84 ms
77,396 KB
testcase_09 AC 261 ms
160,052 KB
testcase_10 AC 124 ms
81,256 KB
testcase_11 AC 380 ms
259,380 KB
testcase_12 AC 137 ms
81,832 KB
testcase_13 AC 228 ms
132,440 KB
testcase_14 AC 163 ms
84,068 KB
testcase_15 AC 201 ms
110,720 KB
testcase_16 AC 85 ms
77,120 KB
testcase_17 AC 410 ms
259,664 KB
testcase_18 AC 459 ms
259,456 KB
testcase_19 AC 455 ms
259,340 KB
testcase_20 AC 456 ms
259,396 KB
testcase_21 AC 457 ms
259,332 KB
testcase_22 AC 471 ms
259,604 KB
testcase_23 AC 746 ms
260,208 KB
testcase_24 AC 743 ms
259,948 KB
testcase_25 AC 735 ms
260,284 KB
testcase_26 AC 724 ms
260,248 KB
testcase_27 AC 724 ms
260,132 KB
testcase_28 AC 702 ms
259,596 KB
testcase_29 AC 79 ms
76,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys

def main():
    N = int(input())
    A = list(map(int, input().split()))
    dp = 1 # 和がkのものが何個あるか (mod2) -> 最初は和0が1個のみ
    for aa in A:
        dp ^= (dp << aa)
        # print(bin(dp))
    ans = 0
    d = str(bin(dp))[2:]
    for i in range(len(d)):
        if int(d[i]):
            ans ^= i
            # print(ans)
    print(ans)


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