結果
問題 | No.3018 目隠し宝探し |
ユーザー |
![]() |
提出日時 | 2025-01-25 14:01:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 80 ms / 2,000 ms |
コード長 | 1,076 bytes |
コンパイル時間 | 1,459 ms |
コンパイル使用メモリ | 162,516 KB |
実行使用メモリ | 25,856 KB |
平均クエリ数 | 2.68 |
最終ジャッジ日時 | 2025-01-25 23:05:03 |
合計ジャッジ時間 | 4,623 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, n) for (int i = 0; i < (int)(n); i++)typedef vector<int> VI;typedef vector<VI> VVI;typedef vector<long long> VL;typedef vector<VL> VVL;typedef long long LL;#define all(a) (a).begin(), (a).end()#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl#define ALL(a) (a).begin(),(a).end()#define pb push_backint main() {int h,w,d,dd;cin>>h>>w;if(h==1&&w==1){cout<<"! 1 1"<<endl;return 0;}if(h==1){cout<<"? "<<1<<' '<<1<<endl;cin>>d;for(int j=1;j<=w;j++){if(d==(j-1)*(j-1)){cout<<"! "<<1<<' '<<j<<endl;return 0;}}}if(w==1){cout<<"? "<<1<<' '<<1<<endl;cin>>d;for(int j=1;j<=h;j++){if(d==(j-1)*(j-1)){cout<<"! "<<j<<' '<<1<<endl;return 0;}}}cout<<"? "<<1<<' '<<1<<endl;cin>>d;cout<<"? "<<1<<' '<<w<<endl;cin>>dd;for(int i=1;i<=h;i++)for(int j=1;j<=w;j++){if((i-1)*(i-1)+(j-1)*(j-1)==d&&(i-1)*(i-1)+(j-w)*(j-w)==dd){cout<<"! "<<i<<' '<<j<<endl;//return 0;}}}