結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
0214sh7
|
| 提出日時 | 2025-02-22 03:25:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,777 bytes |
| コンパイル時間 | 1,998 ms |
| コンパイル使用メモリ | 196,532 KB |
| 実行使用メモリ | 25,984 KB |
| 平均クエリ数 | 2.68 |
| 最終ジャッジ日時 | 2025-02-22 03:25:39 |
| 合計ジャッジ時間 | 5,164 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> PP;
// #define MOD 1000000007
#define MOD 998244353
#define INF 2305843009213693951
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define ORREP(i,n) for(ll i=(n);i>=1;--i)
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define chmin(k,m) k = min(k,m)
#define chmax(k,m) k = max(k,m)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
ll H,W;
ll output(ll i, ll j){
cout << "?" MM i+1 MM j+1 << endl;
ll d;
cin >> d;
if(d==-1){
exit(1);
}
return d;
}
void answer(ll i, ll j){
cout << "!" MM i+1 MM j+1 << endl;
exit(0);
}
int main(void){
//cin.tie(nullptr);
//ios::sync_with_stdio(false);
cin >> H >> W;
if(H==1 && W==1){
answer(0,0);
}
if(H==1){
ll d = output(0,0);
answer(0,d);
}
if(W==1){
ll d = output(0,0);
answer(d,0);
}
ll d1 = output(0,0);
ll d2 = output(H-1,0);
vector<pair<ll,ll>> Ans;
REP(i,H){
REP(j,W){
if(i*i+j*j==d1 && (H-1-i)*(H-1-i)+j*j==d2){
Ans.push_back({i,j});
}
}
}
assert(Ans.size() <= 2);
if(Ans.size()==1){
answer(Ans[0].first,Ans[0].second);
}else{
ll d3 = output(Ans[0].first,Ans[0].second);
if(d3==0){
answer(Ans[0].first,Ans[0].second);
}else{
answer(Ans[1].first,Ans[1].second);
}
}
return 0;
}
0214sh7