結果
| 問題 | No.3680 セグメント釣り |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-08 11:53:13 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 287 ms / 2,000 ms |
| + 434µs | |
| コード長 | 544 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 82,592 KB |
| 実行使用メモリ | 84,840 KB |
| 最終ジャッジ日時 | 2026-09-08 11:53:21 |
| 合計ジャッジ時間 | 6,887 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
inf = 10**19
def solve():
sx, sy, tx, ty = map(int, input().split())
if sx > tx:
sx, sy, tx, ty = tx, ty, sx, sy
base_cost = abs(sy - ty)
Y = max(sy, ty)
up = 0
ans = 10**18
# print(Y)
while True:
t_len = 1<<(Y+up) if (Y+up) < 60 else inf
tr = tx // t_len
tl = sx // t_len
dist = tr - tl
# print(up, t_len, dist)
ans = min(ans, dist + up*2)
if dist == 0: break
up += 1
print(ans + base_cost)
for _ in range(int(input())):
solve()