結果
問題 | No.3018 目隠し宝探し |
ユーザー |
![]() |
提出日時 | 2025-01-27 08:29:13 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 103 ms / 2,000 ms |
コード長 | 1,101 bytes |
コンパイル時間 | 3,748 ms |
コンパイル使用メモリ | 273,996 KB |
実行使用メモリ | 25,984 KB |
平均クエリ数 | 2.68 |
最終ジャッジ日時 | 2025-01-27 08:29:20 |
合計ジャッジ時間 | 6,587 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; template<class T>using V=vector<T>; template<class T>using VV=V<V<T>>; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int h,w; cin>>h>>w; if(h==1 && w==1){ cout<<"! 1 1"<<endl; return 0; } else if(h==1){ cout<<"? 1 1"<<endl; int d1; cin>>d1; for(int j=1;j<=w;j++){ if((j-1)*(j-1)==d1){ cout<<"! "<<1<<" "<<j<<endl; return 0; } } } else if(w==1){ cout<<"? 1 1"<<endl; int d1; cin>>d1; for(int i=1;i<=h;i++){ if((i-1)*(i-1)==d1){ cout<<"! "<<i<<" "<<1<<endl; return 0; } } } else{ cout<<"? 1 1"<<endl; int d1; cin>>d1; cout<<"? 1 2"<<endl; int d2; cin>>d2; for(int i=1;i<=h;i++){ for(int j=1;j<=w;j++){ if((i-1)*(i-1)+(j-1)*(j-1)==d1 && (i-1)*(i-1)+(j-2)*(j-2)==d2){ cout<<"! "<<i<<" "<<j<<endl; return 0; } } } } return 0; }