結果
問題 |
No.3018 目隠し宝探し
|
ユーザー |
|
提出日時 | 2025-01-25 14:48:23 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,479 bytes |
コンパイル時間 | 3,731 ms |
コンパイル使用メモリ | 279,756 KB |
実行使用メモリ | 28,740 KB |
平均クエリ数 | 2.59 |
最終ジャッジ日時 | 2025-01-25 23:30:08 |
合計ジャッジ時間 | 6,501 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 WA * 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; int d; cin >> d; if (d == -1) exit(0); vector<pair<int, int>> nc; for (auto [i, j] : c) { if ((qi - i) * (qi - i) + (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 and qj == 1) qi = h; else if (qi == h and qj == 1) qj = w; else if (qi == h and qj == w) qi = 1; else { qi = rand() % h + 1; qj = rand() % w + 1; } } swap(c, nc); } return 0; }