結果

問題 No.3680 セグメント釣り
コンテスト
ユーザー yuunegi
提出日時 2026-09-05 15:20:29
言語 C++23
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 261 ms / 2,000 ms
+ 458µs
コード長 467 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,244 ms
コンパイル使用メモリ 330,564 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-09-05 15:20:46
合計ジャッジ時間 8,458 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int t;
    cin>>t;
    while(t--){
        long long sx,sy,tx,ty;
        cin>>sx>>sy>>tx>>ty;
        if(max(sy,ty)>=61){
            cout<<abs(sy-ty)<<endl;
            continue;
        }
        long long ans=1e18;
        for(long long i=max(sy,ty);i<61;i++){
            ans=min(abs(sy-i)+abs(ty-i)+abs((tx/(1LL<<i))-(sx/(1LL<<i))),ans);
        }
        cout<<ans<<endl;
    }
    return 0;
}
0