結果

問題 No.1876 Xor of Sum
ユーザー nephrologistnephrologist
提出日時 2022-03-24 14:00:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 620 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 259,608 KB
最終ジャッジ日時 2024-04-20 23:54:11
合計ジャッジ時間 9,466 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,840 KB
testcase_01 AC 38 ms
51,712 KB
testcase_02 AC 38 ms
51,584 KB
testcase_03 AC 106 ms
81,152 KB
testcase_04 AC 241 ms
191,360 KB
testcase_05 AC 45 ms
62,800 KB
testcase_06 AC 395 ms
258,432 KB
testcase_07 AC 48 ms
64,372 KB
testcase_08 AC 51 ms
63,488 KB
testcase_09 AC 206 ms
159,488 KB
testcase_10 AC 91 ms
79,948 KB
testcase_11 AC 324 ms
258,748 KB
testcase_12 AC 92 ms
81,332 KB
testcase_13 AC 173 ms
131,840 KB
testcase_14 AC 116 ms
83,328 KB
testcase_15 AC 156 ms
109,952 KB
testcase_16 AC 45 ms
61,440 KB
testcase_17 AC 343 ms
258,296 KB
testcase_18 AC 378 ms
258,448 KB
testcase_19 AC 378 ms
258,820 KB
testcase_20 AC 385 ms
258,380 KB
testcase_21 AC 387 ms
258,400 KB
testcase_22 AC 384 ms
258,588 KB
testcase_23 AC 614 ms
259,196 KB
testcase_24 AC 620 ms
258,944 KB
testcase_25 AC 609 ms
259,608 KB
testcase_26 AC 615 ms
259,196 KB
testcase_27 AC 611 ms
259,308 KB
testcase_28 AC 590 ms
258,916 KB
testcase_29 AC 41 ms
61,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline

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

temp = 1

for a in A:
    nx = temp << a
    # print("temp", bin(temp), "nx", bin(nx))
    temp ^= nx

# ans = 0
# keta = 0
# while temp:
#     if temp % 2:
#         ans ^= keta
#     temp //= 2
#     keta += 1
binary = bin(temp)[2:]
ans = 0
for i in range(len(binary)):
    if binary[len(binary) - i - 1] == "1":
        ans ^= i

print(ans)
0