結果
問題 | No.3018 目隠し宝探し |
ユーザー |
![]() |
提出日時 | 2025-01-25 14:40:08 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,455 bytes |
コンパイル時間 | 6,023 ms |
コンパイル使用メモリ | 332,036 KB |
実行使用メモリ | 26,296 KB |
平均クエリ数 | 1.23 |
最終ジャッジ日時 | 2025-01-25 23:26:19 |
合計ジャッジ時間 | 8,653 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge9 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | AC * 6 RE * 15 |
ソースコード
#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;rep(i, h) rep(j, w) if(i * i + j * j == d) cout << "! " << i + 1 << ' ' << j + 1 << endl;return 0;}return 1;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);}rep(i, h) rep(j, w) if(ok.at(i).at(j)){cout << "! " << i + 1 << ' ' << j + 1 << endl;return 0;}}