結果
| 問題 |
No.1569 Nixoracci's Number
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:13:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 497 bytes |
| コンパイル時間 | 187 ms |
| コンパイル使用メモリ | 82,448 KB |
| 実行使用メモリ | 53,988 KB |
| 最終ジャッジ日時 | 2025-03-20 21:14:36 |
| 合計ジャッジ時間 | 1,936 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
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)
lam6er