結果
| 問題 | No.3680 セグメント釣り |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-09-06 16:42:41 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 47 ms / 2,000 ms |
| + 448µs | |
| コード長 | 842 bytes |
| 記録 | |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 51,884 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-06 16:42:46 |
| 合計ジャッジ時間 | 4,060 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3680.cc: No.3680 繧サ繧ー繝。繝ウ繝磯・繧・- yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
using ll = long long;
/* global variables */
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
ll sx, sy, tx, ty;
scanf("%lld%lld%lld%lld", &sx, &sy, &tx, &ty);
ll ut = (sy < 60 ? (sx >> sy) : 0), uy = sy;
ll vt = (ty < 60 ? (tx >> ty) : 0), vy = ty;
ll d = 0;
if (uy > vy) d = uy - vy, vt >>= min(60LL, d), vy = uy;
else if (uy < vy) d += vy - uy, ut >>= min(60LL, d), uy = vy;
ll mind = d + abs(ut - vt);
while (ut != vt) {
d += 2;
ut >>= 1, vt >>= 1;
mind = min(mind, d + abs(ut - vt));
}
printf("%lld\n", mind);
}
return 0;
}
tnakao0123