結果
| 問題 | No.3018 目隠し宝探し |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 13:30:45 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 822 bytes |
| 記録 | |
| コンパイル時間 | 1,312 ms |
| コンパイル使用メモリ | 213,760 KB |
| 実行使用メモリ | 29,920 KB |
| 平均クエリ数 | 2.64 |
| 最終ジャッジ日時 | 2026-06-23 23:00:06 |
| 合計ジャッジ時間 | 4,117 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 RE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int h, w, d;
cin >> h >> w;
cout << "? 1 1" << endl;
cin >> d;
vector<pair<int,int>> cand;
for(int y = 1; y <= h; y++){
for(int x = 1; x <= w; x++){
if((y - 1) * (y - 1) + (x - 1) * (x - 1) == d){
cand.emplace_back(y, x);
}
}
}
if(cand.size() == 1){
auto [y, x] = cand[0];
cout << "! " << y << ' ' << x << endl;
return 0;
}
cout << "? " << h << ' ' << 1 << endl;
cin >> d;
for(auto [y, x] : cand){
if((y - h) * (y - h) + (x - 1) * (x - 1) == d){
cout << "! " << y << ' ' << x << endl;
return 0;
}
}
assert(false);
}