結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-22 02:45:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,124 bytes |
| コンパイル時間 | 4,666 ms |
| コンパイル使用メモリ | 253,168 KB |
| 実行使用メモリ | 25,972 KB |
| 平均クエリ数 | 2.64 |
| 最終ジャッジ日時 | 2025-02-22 02:45:56 |
| 合計ジャッジ時間 | 9,418 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 16 WA * 4 RE * 1 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
template<typename T>
bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
template<typename T>
bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }
struct io_setup {
io_setup() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << fixed << setprecision(15);
}
} io_setup;
int main(){
int h,w;
cin>>h>>w;
if(h==1&&w==1){
cout<<"! 1 1\n";
return 0;
}
if(h==1||w==1){
cout<<"? 1 1"<<endl;
int dd;
cin>>dd;
rep(lp,1,max(h,w)+1){
if(lp*lp==dd){
if(h==1){
cout<<"! 1 "<<lp<<"\n";
}else{
cout<<"! "<<lp<<" 1\n";
}
return 0;
}
assert(lp*lp<dd);
}
}
int a,b;
cout<<"? 1 1"<<endl;
cin>>a;
cout<<"? 1 "<<w<<endl;
cin>>b;
tuple<int,int> tt={a,b};
rep(lh,1,h+1) rep(lw,1,w+1){
int sa=abs(1-lh)*abs(1-lh)+abs(1-lw)*abs(1-lw);
int sb=abs(1-lh)*abs(1-lh)+abs(w-lw)*abs(w-lw);
tuple<int,int> st={sa,sb};
if(st==tt){
cout<<"! "<<lh<<" "<<lw<<"\n";
return 0;
}
}
assert(-1);
}