結果
問題 | No.3018 目隠し宝探し |
ユーザー |
|
提出日時 | 2025-01-25 14:44:06 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,268 bytes |
コンパイル時間 | 3,174 ms |
コンパイル使用メモリ | 279,860 KB |
実行使用メモリ | 87,280 KB |
平均クエリ数 | 2.55 |
最終ジャッジ日時 | 2025-01-25 23:28:26 |
合計ジャッジ時間 | 9,317 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 TLE * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef local#include <debug.hpp>#else#define debug(...)#endif#define rep(i, n) for (int i = 0; i < n; i++)template <class T> istream& operator>>(istream& I, vector<T>& V) {for (T& X : V) I >> X; return I;}template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}vector<int> di = {-1, 1, 0, 0}, dj = {0, 0, -1, 1}; int inf = 2e9; long INF = 1e18;int main() {int h, w;cin >> h >> w;vector<pair<int, int>> c;rep(i, h) rep(j, w) c.emplace_back(i + 1, j + 1);int qi = 1, qj = 1;while (true) {cout << "? " << qi << " " << qj << endl;long d;cin >> d;vector<pair<int, int>> nc;for (auto [i, j] : c) {if ((long)(qi - i) * (qi - i) + (long)(qj - j) * (qj - j) == d) {nc.emplace_back(i, j);}}if (nc.size() == 1) {auto [i, j] = nc[0];cout << "! " << i << " " << j << endl;break;} else {if (qi + 1 != h) qi++;else qj++;}swap(c, nc);}return 0;}