結果
| 問題 | No.3680 セグメント釣り |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-09-05 13:52:35 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 588 bytes |
| 記録 | |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 96,204 KB |
| 実行使用メモリ | 100,736 KB |
| 最終ジャッジ日時 | 2026-09-05 13:54:02 |
| 合計ジャッジ時間 | 15,892 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 WA * 7 TLE * 1 |
ソースコード
from sys import stdin
input = stdin.readline
def encode(sx, sy):
l = sx
r = sx
for i in range(sy):
if 1<<i & l:
l ^= 1<<i
if not 1<<i &r:
r ^= 1<<i
return l, r
for _ in range(int(input())):
sx, sy, tx, ty = map(int, input().split())
if 60 < max(sy, ty):
print(abs(sy-ty))
continue
sy = min(sy, 60)
ty = min(ty, 60)
ans = 1<<60
for i in range(max(sy, ty), 61):
a, b = encode(sx, i)
c, d = encode(tx, i)
ans = min(ans, (i-sy)+(i-ty)+abs(a+c)//(1<<i))
print(ans)
detteiuu