結果
問題 | No.3018 目隠し宝探し |
ユーザー |
|
提出日時 | 2025-02-22 02:53:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 92 ms / 2,000 ms |
コード長 | 926 bytes |
コンパイル時間 | 4,234 ms |
コンパイル使用メモリ | 276,768 KB |
実行使用メモリ | 25,972 KB |
平均クエリ数 | 2.59 |
最終ジャッジ日時 | 2025-02-22 02:53:25 |
合計ジャッジ時間 | 6,545 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(a) begin(a), end(a) #define rep(i,a,b) for(ll i = a; i < (b); i++) int main(){ ll h,w; cin >> h >> w; if(h == 1 && w == 1){ cout << "! " << 1 << " " << 1 << endl; return 0; } ll a,b; cout << "? 1 1" << endl; cin>> a; vector<pair<ll,ll>> res; rep(i,1,h+1){ rep(j,1,w+1){ if((i-1)*(i-1) + (j-1)*(j-1) == a){ res.push_back({i,j}); } } } if(res.size() == 1){ cout << "! " << res[0].first << " " << res[0].second << endl; return 0; } cout << "? 1 2" << endl; cin>> b; rep(i,1,h+1){ rep(j,1,w+1){ if((i-1)*(i-1) + (j-1)*(j-1) == a && (i-1)*(i-1) + (j-2)*(j-2) == b){ cout << "! " << i << " " << j << endl; } } } return 0; } // 1 3 // 4 +