結果
| 問題 | No.3680 セグメント釣り |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 15:01:34 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 708 bytes |
| 記録 | |
| コンパイル時間 | 3,451 ms |
| コンパイル使用メモリ | 348,992 KB |
| 実行使用メモリ | 9,780 KB |
| 最終ジャッジ日時 | 2026-09-05 15:01:47 |
| 合計ジャッジ時間 | 7,731 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long sx, sy, tx, ty;
cin >> sx >> sy >> tx >> ty;
long long ans = 1e18;
if (sy >= ty) {
if (sy >= 60) {
ans = sy - ty;
} else {
ans = abs(sx / (1LL << sy) - tx / (1LL << sy)) + (sy - ty);
}
}
if (sy >= 60) {
ans = min(ans, abs(sy - ty));
}
for (long long i = sy; i <= ty && i <= 60; i++) {
ans = min(ans, abs(sx / (1LL << i) - tx / (1LL << i)) + abs(sy - ty));
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
solve();
}
return 0;
}