結果
| 問題 |
No.814 ジジ抜き
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 18:24:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,707 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 174,096 KB |
| 最終ジャッジ日時 | 2025-06-12 18:26:09 |
| 合計ジャッジ時間 | 33,861 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | MLE * 23 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N = int(input[idx])
idx += 1
players = []
for _ in range(N):
K = int(input[idx])
L = int(input[idx+1])
D = int(input[idx+2])
idx += 3
players.append((K, L, D))
x = 0
for j in range(60):
cnt = 0
for (K, L, D) in players:
if D > j:
if (L >> j) & 1:
if K % 2 == 1:
cnt += 1
else:
A = L % (1 << (j + 1))
two_j = 1 << j
two_D = 1 << D
P = 1 << (j + 1 - D)
numerator_low = two_j - A
if numerator_low < 0:
low = 0
else:
low = (numerator_low + two_D - 1) // two_D
numerator_high = (1 << (j + 1)) - A - 1
high = numerator_high // two_D
low = max(low, 0)
high = min(high, P - 1)
if low > high:
C = 0
else:
C = high - low + 1
C_mod = C % 2
full_cycles = K // P
rem = K % P
R_low = low
R_high = min(high, rem - 1) if rem > 0 else -1
if R_low > R_high or rem == 0:
R = 0
else:
R = R_high - R_low + 1
R_mod = R % 2
total_mod = ( (full_cycles % 2) * C_mod + R_mod ) % 2
cnt += total_mod
if cnt % 2 == 1:
x |= (1 << j)
print(x)
if __name__ == '__main__':
main()
gew1fw