結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 19:46:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 720 bytes |
| コンパイル時間 | 3,080 ms |
| コンパイル使用メモリ | 65,152 KB |
| 実行使用メモリ | 25,972 KB |
| 平均クエリ数 | 2.73 |
| 最終ジャッジ日時 | 2025-01-26 00:03:56 |
| 合計ジャッジ時間 | 3,952 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge12 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 WA * 6 |
ソースコード
#include<iostream>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
int in;
int Q(int y, int x){
cout<<"? "<<y<<" "<<x<<endl;
cin>>in;
return in;
}
void A(int y, int x){
cout<<"! "<<y<<" "<<x<<endl;
exit(0);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int H,W;
cin>>H>>W;
if(H==1){
int k=Q(1,1);
A(1,(int)sqrtl(k+0.1));
}
if(W==1){
int k=Q(1,1);
A((int)sqrtl(k+0.1),1);
}
int a=Q(1,1);
int b=Q(1,W);
for(int i=H+1;i--;)for(int j=W+1;j--;){
if((i-1)*(i-1)+(j-1)*(j-1)==a && (i-1)*(i-1)+(j-W)*(j-W)==b){
A(i,j);
}
}
}