結果

問題 No.3018 目隠し宝探し
ユーザー hirakuuuuhirakuuuu
提出日時 2025-01-25 13:36:51
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,186 bytes
コンパイル時間 3,021 ms
コンパイル使用メモリ 282,112 KB
実行使用メモリ 25,984 KB
平均クエリ数 2.73
最終ジャッジ日時 2025-01-25 22:52:20
合計ジャッジ時間 5,810 ms
ジャッジサーバーID
(参考情報)
judge2 / judge9
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define ld long double
// using mint = modint1000000007;
// using mint = modint998244353;
constexpr int IINF = 1001001001;
constexpr ll INF = 1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
int main(){
int h, w; cin >> h >> w;
cout << "? " << 1 << ' ' << 1 << endl;
int d; cin >> d;
set<pair<int, int>> s;
{
rep(i, 1, h+1) rep(j, 1, w+1){
if((i-1)*(i-1)+(j-1)*(j-1) == d){
s.insert({i, j});
}
}
if(s.size() == 1){
cout << "! " << (*s.begin()).first << ' ' << (*s.begin()).second << endl;
return 0;
}
}
cout << "? " << 1 << ' ' << w << endl;
cin >> d;
{
set<pair<int, int>> s_;
for(auto [i, j]: s){
if((i-1)*(i-1)+(j-w)*(j-w) == d){
s_.insert({i, j});
}
}
swap(s_, s);
if(s.size() == 1){
cout << "! " << (*s.begin()).first << ' ' << (*s.begin()).second << endl;
return 0;
}
}
cout << "? " << h << ' ' << 1 << endl;
cin >> d;
{
set<pair<int, int>> s_;
for(auto [i, j]: s){
if((i-h)*(i-h)+(j-1)*(j-1) == d){
s_.insert({i, j});
}
}
swap(s_, s);
if(s.size() == 1){
cout << "! " << (*s.begin()).first << ' ' << (*s.begin()).second << endl;
return 0;
}
}
cout << "? " << h << ' ' << w << endl;
cin >> d;
{
set<pair<int, int>> s_;
for(auto [i, j]: s){
if((i-h)*(i-h)+(j-w)*(j-w) == d){
s_.insert({i, j});
}
}
swap(s_, s);
if(s.size() == 1){
cout << "! " << (*s.begin()).first << ' ' << (*s.begin()).second << endl;
return 0;
}
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0