結果

問題 No.1876 Xor of Sum
ユーザー nephrologist
提出日時 2022-03-24 14:00:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 668 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 258,816 KB
最終ジャッジ日時 2024-10-12 22:12:25
合計ジャッジ時間 9,894 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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