結果
| 問題 | No.3680 セグメント釣り |
| コンテスト | |
| ユーザー |
のらら
|
| 提出日時 | 2026-09-05 13:42:19 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 255 ms / 2,000 ms |
| + 635µs | |
| コード長 | 868 bytes |
| 記録 | |
| コンパイル時間 | 2,740 ms |
| コンパイル使用メモリ | 264,604 KB |
| 実行使用メモリ | 9,716 KB |
| 最終ジャッジ日時 | 2026-09-05 13:46:06 |
| 合計ジャッジ時間 | 8,822 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include <iostream>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
//#define endl "\n";
int main(){
ll Q;
cin >> Q;
vector<ll> pow2(69, 0);
pow2[0] = 1;
for(int i = 0; i < 60; i++) pow2[i + 1] = pow2[i] * 2;
for(int q = 1; q <= Q; q++){
ll sx, sy, tx, ty;
cin >> sx >> sy >> tx >> ty;
if(sy >= 60 && ty >= 60){
cout << abs(sy - ty) << endl;
continue;
}
ll ans = 3e18;
for(ll i = 0; i <= 60; i++){
ll posx = sx / pow2[i];
ll posy = tx / pow2[i];
//cout << i << " " << abs(sy - i) << " " << abs(ty - i) << " " << abs(posx - posy) << endl;
ans = min(ans, abs(sy - i) + abs(ty - i) + abs(posx - posy));
}
cout << ans << endl;
}
return 0;
}
のらら