結果

問題 No.1876 Xor of Sum
ユーザー ああいいああいい
提出日時 2022-03-13 21:54:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 705 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 258,460 KB
最終ジャッジ日時 2023-10-19 09:20:58
合計ジャッジ時間 10,474 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,284 KB
testcase_01 AC 39 ms
53,284 KB
testcase_02 AC 39 ms
53,284 KB
testcase_03 AC 103 ms
79,792 KB
testcase_04 AC 253 ms
189,144 KB
testcase_05 AC 48 ms
62,432 KB
testcase_06 AC 417 ms
257,928 KB
testcase_07 AC 52 ms
64,720 KB
testcase_08 AC 48 ms
62,488 KB
testcase_09 AC 217 ms
157,280 KB
testcase_10 AC 90 ms
78,828 KB
testcase_11 AC 345 ms
257,924 KB
testcase_12 AC 103 ms
79,872 KB
testcase_13 AC 188 ms
129,720 KB
testcase_14 AC 126 ms
81,252 KB
testcase_15 AC 161 ms
108,108 KB
testcase_16 AC 48 ms
62,316 KB
testcase_17 AC 372 ms
257,924 KB
testcase_18 AC 423 ms
258,176 KB
testcase_19 AC 421 ms
258,000 KB
testcase_20 AC 414 ms
257,988 KB
testcase_21 AC 425 ms
257,904 KB
testcase_22 AC 434 ms
257,976 KB
testcase_23 AC 705 ms
258,132 KB
testcase_24 AC 704 ms
258,436 KB
testcase_25 AC 677 ms
258,128 KB
testcase_26 AC 681 ms
258,156 KB
testcase_27 AC 680 ms
258,204 KB
testcase_28 AC 669 ms
258,460 KB
testcase_29 AC 46 ms
59,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
rr = sys.stdin

N = int(rr.readline())
A = list(map(int,rr.readline().split()))

dp = 1
S = 0
for a in A:
    #dp ^= (dp << a)
    dp = dp << a ^ dp
    S += a
ans = 0
mask = 1

T = bin(dp)
for i in range(1,S+1):
    if T[-1-i] == "1":
        ans ^= i
print(ans)
0