結果

問題 No.1876 Xor of Sum
ユーザー titiatitia
提出日時 2022-03-14 00:54:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,224 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 11,784 KB
実行使用メモリ 19,992 KB
最終ジャッジ日時 2023-10-19 12:42:28
合計ジャッジ時間 15,595 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,052 KB
testcase_01 AC 29 ms
10,052 KB
testcase_02 AC 29 ms
10,052 KB
testcase_03 AC 204 ms
12,028 KB
testcase_04 AC 376 ms
13,604 KB
testcase_05 AC 61 ms
10,272 KB
testcase_06 AC 588 ms
14,568 KB
testcase_07 AC 68 ms
10,388 KB
testcase_08 AC 62 ms
10,280 KB
testcase_09 AC 337 ms
13,272 KB
testcase_10 AC 168 ms
11,708 KB
testcase_11 AC 452 ms
14,292 KB
testcase_12 AC 202 ms
12,140 KB
testcase_13 AC 310 ms
13,040 KB
testcase_14 AC 256 ms
12,420 KB
testcase_15 AC 297 ms
12,948 KB
testcase_16 AC 56 ms
10,236 KB
testcase_17 AC 518 ms
14,520 KB
testcase_18 AC 584 ms
15,104 KB
testcase_19 AC 595 ms
14,308 KB
testcase_20 AC 577 ms
15,096 KB
testcase_21 AC 592 ms
15,100 KB
testcase_22 AC 593 ms
15,252 KB
testcase_23 AC 1,193 ms
18,420 KB
testcase_24 AC 1,224 ms
19,992 KB
testcase_25 AC 1,165 ms
18,924 KB
testcase_26 AC 1,203 ms
18,420 KB
testcase_27 AC 1,203 ms
19,988 KB
testcase_28 AC 1,081 ms
19,212 KB
testcase_29 AC 29 ms
10,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 解説を読みました。自力で解きたい問題でした。

import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))

DP=1
for a in A:
    DP^=(DP<<a)

S=bin(DP)[2:][::-1]

ANS=0
for i in range(len(S)):
    if S[i]=="1":
        ANS^=i

print(ANS)
0