結果
問題 |
No.3018 目隠し宝探し
|
ユーザー |
|
提出日時 | 2025-02-22 02:44:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,226 bytes |
コンパイル時間 | 3,748 ms |
コンパイル使用メモリ | 254,188 KB |
実行使用メモリ | 26,216 KB |
平均クエリ数 | 2.64 |
最終ジャッジ日時 | 2025-02-22 02:44:34 |
合計ジャッジ時間 | 6,784 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 1 WA * 19 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,c; cout<<"? 1 1"<<endl; cin>>a; cout<<"? 1 "<<w<<endl; cin>>b; cout<<"? "<<h<<" 1"<<endl; cin>>c; tuple<int,int,int> tt={a,b,c}; 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); int sc=abs(h-lh)*abs(h-lh)+abs(1-lw)*abs(1-lw); tuple<int,int,int> st={sa,sb,sc}; if(st==tt){ cout<<"! "<<lh<<" "<<lw<<"\n"; return 0; } } assert(-1); }