結果
問題 | No.3018 目隠し宝探し |
ユーザー |
![]() |
提出日時 | 2025-01-25 13:36:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,417 bytes |
コンパイル時間 | 6,050 ms |
コンパイル使用メモリ | 332,440 KB |
実行使用メモリ | 26,216 KB |
平均クエリ数 | 1.95 |
最終ジャッジ日時 | 2025-01-25 22:51:48 |
合計ジャッジ時間 | 8,118 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 3 WA * 18 |
ソースコード
#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;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;}rep(i, h) rep(j, w) if(ok.at(i).at(j)){cout << "! " << i + 1 << ' ' << j + 1 << endl;return 0;}}