結果

問題 No.3018 目隠し宝探し
ユーザー Tatsu_mr
提出日時 2025-01-25 14:33:40
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,157 bytes
コンパイル時間 3,419 ms
コンパイル使用メモリ 276,696 KB
実行使用メモリ 26,120 KB
平均クエリ数 3.91
最終ジャッジ日時 2025-01-25 23:23:24
合計ジャッジ時間 6,627 ms
ジャッジサーバーID
(参考情報)
judge7 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) For(i, 0, n)
#define rFor(i, a, b) for(int i = (a); i >= (b); i--)
#define ALL(v) (v).begin(), (v).end()
#define rALL(v) (v).rbegin(), (v).rend()

using lint = long long;
using ld = long double;

int INF = 2000000000;
lint LINF = 1000000000000000000;

int dist(int i, int j, int ii, int jj) {
    int dii = abs(i - ii);
    int djj = abs(j - jj);
    return dii * dii + djj * djj;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int h, w;
    cin >> h >> w;
    auto ask = [](int i, int j) -> int {
        cout << "? " << i << " " << j << "\n";
        cout.flush();
        int d;
        cin >> d;
        return d;
    };
    int d = ask(1, 1);
    vector<pair<int, int>> v;
    For(i, 1, h + 1) {
        For(j, 1, w + 1) {
            if (dist(i, j, 1, 1) == d) {
                v.emplace_back(i, j);
            }
        }
    }
    for (auto &[i, j] : v) {
        if (ask(i, j) == 0) {
            cout << "! " << i << " " << j << "\n";
            cout.flush();
            return 0;
        }
    }
}
0