結果

問題 No.3018 目隠し宝探し
ユーザー a01sa01to
提出日時 2025-01-29 00:34:23
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,005 bytes
コンパイル時間 4,472 ms
コンパイル使用メモリ 273,284 KB
実行使用メモリ 26,456 KB
平均クエリ数 2.68
最終ジャッジ日時 2025-01-29 00:34:31
合計ジャッジ時間 6,828 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#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;
if (h != 1) {
cout << "! " << x << " 1" << endl;
}
else {
cout << "! 1 " << x << 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;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0