結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-01-29 00:39:34 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 1,035 bytes |
| コンパイル時間 | 4,123 ms |
| コンパイル使用メモリ | 274,788 KB |
| 実行使用メモリ | 25,984 KB |
| 平均クエリ数 | 2.68 |
| 最終ジャッジ日時 | 2025-01-29 00:39:43 |
| 合計ジャッジ時間 | 6,177 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
inline ll dist(ll x1, ll y1, ll x2, ll y2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
int main() {
int h, w;
cin >> h >> w;
if (h == 1 && w == 1) {
cout << "! 1 1" << endl;
return 0;
}
if (h == 1 || w == 1) {
cout << "? 1 1" << endl;
int x;
cin >> x;
x = int(sqrt(x));
if (h != 1) {
cout << "! " << x + 1 << " 1" << endl;
}
else {
cout << "! 1 " << x + 1 << endl;
}
return 0;
}
ll x, y;
cout << "? 1 1" << endl;
cin >> x;
cout << "? 1 " << w << endl;
cin >> y;
for (int i = 1; i <= h; ++i) {
for (int j = 1; j <= w; ++j) {
if (dist(i, j, 1, 1) == x && dist(i, j, 1, w) == y) {
cout << "! " << i << ' ' << j << endl;
return 0;
}
}
}
assert(false);
return 0;
}
a01sa01to