結果
問題 | No.3018 目隠し宝探し |
ユーザー |
![]() |
提出日時 | 2025-01-25 14:26:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,530 bytes |
コンパイル時間 | 7,756 ms |
コンパイル使用メモリ | 332,536 KB |
実行使用メモリ | 25,920 KB |
平均クエリ数 | 2.36 |
最終ジャッジ日時 | 2025-01-25 23:18:54 |
合計ジャッジ時間 | 9,002 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge7 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 3 WA * 11 RE * 7 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;#define all(x) (x).begin(), (x).end()#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define rrep(i, n) for(int i = (int)(n - 1); i >= 0; i--)template <typename T> bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}template <typename T> bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}using ll = long long;#define int llusing vi = vector<int>;using vvi = vector<vector<int>>;using vb = vector<bool>;using vvb = vector<vector<bool>>;using vs = vector<string>;using pii = pair<int, int>;/*using mint = modint;using vm = vector<mint>;using vvm = vector<vector<mint>>;*/signed main(){int h, w; cin >> h >> w;if(h * w == 1){cout << "! 1 1" << endl;return 0;}if(h == 1 || w == 1){cout << "? 1 1" << endl;int d; cin >> d;if(h == 1) cout << "! 1 " << 1 + d << endl;else cout << "! " << 1 + d << " 1" << endl;return 0;}const vector<pii> v = {{0, 0}, {0, h - 1}};vvb ok(h, vb(w, true));rep(idx, 2){auto &[ni, nj] = v.at(idx);cout << "? " << ni + 1 << ' ' << nj + 1 << endl;int d; cin >> d;if(d == -1) return 1;rep(i, h) rep(j, w) ok.at(i).at(j) = ok.at(i).at(j) && (i - ni) * (i - ni) + (j - nj) * (j - nj) == d;}vector<pii> ans;rep(i, h) rep(j, w) if(ok.at(i).at(j)) ans.emplace_back(i, j);if(ans.size() != 1) return 1;auto &[ansi, ansj] = ans.at(0);cout << "! " << ansi << ' ' << ansj << endl;}