結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 19:49:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 767 bytes |
| コンパイル時間 | 742 ms |
| コンパイル使用メモリ | 64,768 KB |
| 実行使用メモリ | 25,960 KB |
| 平均クエリ数 | 2.64 |
| 最終ジャッジ日時 | 2025-01-26 00:03:54 |
| 合計ジャッジ時間 | 3,664 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 WA * 2 |
ソースコード
#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;
int a=Q(1,1);
int c=0,y,x;
for(int i=H+1;i--;)for(int j=W+1;j--;){
if((i-1)*(i-1)+(j-1)*(j-1)==a){
y=i;
x=j;
c++;
}
}
if(c==1){
A(y,x);
}
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);
}
}
}