結果
| 問題 | No.3520 L1等距離点 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-01 22:03:00 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 2,000 ms |
| コード長 | 622 bytes |
| 記録 | |
| コンパイル時間 | 3,193 ms |
| コンパイル使用メモリ | 330,152 KB |
| 実行使用メモリ | 30,064 KB |
| 平均クエリ数 | 4.83 |
| 最終ジャッジ日時 | 2026-05-01 22:03:12 |
| 合計ジャッジ時間 | 6,537 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
pair<int, int> P0, PT;
cin >> T >> P0.first >> P0.second >> PT.first >> PT.second;
int l = 0, r = T;
while (l + 1 < r) {
int m = (l + r) >> 1, x, y;
cout << "? " << m << endl;
cin >> x >> y;
int d0 = abs(P0.first - x) + abs(P0.second - y), dT = abs(PT.first - x) + abs(PT.second - y);
if (d0 == dT) {
cout << "! " << m << endl;
return 0;
} else if (d0 < dT) {
l = m;
} else {
r = m;
}
}
cout << "! " << l << endl;
}