結果
| 問題 |
No.814 ジジ抜き
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 13:47:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,075 bytes |
| コンパイル時間 | 465 ms |
| コンパイル使用メモリ | 82,392 KB |
| 実行使用メモリ | 154,616 KB |
| 最終ジャッジ日時 | 2025-06-12 13:48:23 |
| 合計ジャッジ時間 | 7,097 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | MLE * 23 |
ソースコード
def xor_upto(n):
mod = n % 4
if mod == 0:
return n
elif mod == 1:
return 1
elif mod == 2:
return n + 1
else:
return 0
def main():
import sys
input = sys.stdin.read().split()
ptr = 0
N = int(input[ptr])
ptr += 1
total_xor = 0
for _ in range(N):
K_i = int(input[ptr])
L_i = int(input[ptr+1])
D_i = int(input[ptr+2])
ptr +=3
s = 1 << D_i
a_low = L_i & (s -1)
a_high = L_i >> D_i
K = K_i
lower_xor = a_low if K % 2 else 0
higher_start = a_high
higher_end = a_high + K -1
if higher_start > higher_end:
higher_xor = 0
else:
xor_end = xor_upto(higher_end)
xor_start = xor_upto(higher_start -1)
higher_xor = xor_end ^ xor_start
higher_xor_part = higher_xor * s
player_xor = lower_xor ^ higher_xor_part
total_xor ^= player_xor
print(total_xor)
if __name__ == "__main__":
main()
gew1fw