結果

問題 No.3680 セグメント釣り
コンテスト
ユーザー Mikan04y
提出日時 2026-07-10 20:28:07
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 610 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,206 ms
コンパイル使用メモリ 349,276 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-09-05 12:33:52
合計ジャッジ時間 5,835 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (ll i = (a); i < (ll)(b); i++)
#define all(x) x.begin(), x.end()

void solve() {
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    ll max_bit = 0;
    rep(i, 0, 62) {
        if ((sx ^ tx) & (1LL << i)) {
            max_bit = i;
        }
    }

    ll ans = 0;
    ans += max(0LL, max_bit - sy);
    ans += abs(max(max_bit, sy) - ty);

    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
}
0