結果

問題 No.1569 Nixoracci's Number
コンテスト
ユーザー lam6er
提出日時 2025-03-20 21:13:03
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 35 ms / 2,000 ms
+ 443µs
コード長 497 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 90 ms
コンパイル使用メモリ 64,396 KB
実行使用メモリ 53,828 KB
最終ジャッジ日時 2026-10-16 23:50:50
合計ジャッジ時間 2,776 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, k = map(int, input().split())
a = list(map(int, input().split()))

if k <= n:
    print(a[k-1])
    exit()

# Compute cumulative XOR array
cumulative_xor = [0] * (n + 1)
for i in range(1, n + 1):
    cumulative_xor[i] = cumulative_xor[i-1] ^ a[i-1]

period = n + 1
k_mod = k % period
k_prev_mod = (k - 1) % period

xk = cumulative_xor[k_mod] if k_mod != 0 else cumulative_xor[0]
xk_prev = cumulative_xor[k_prev_mod] if k_prev_mod != 0 else cumulative_xor[0]

result = xk ^ xk_prev
print(result)
0