結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-22 03:27:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 906 bytes |
| コンパイル時間 | 3,014 ms |
| コンパイル使用メモリ | 273,848 KB |
| 実行使用メモリ | 25,984 KB |
| 平均クエリ数 | 3.14 |
| 最終ジャッジ日時 | 2025-02-22 03:28:00 |
| 合計ジャッジ時間 | 5,788 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 |
ソースコード
#include <atcoder/lazysegtree.hpp>
using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define chmin(x, y) x = min(x, y)
// #include <all.hpp>
// #define int long long
signed main() {
int h, w;
cin >> h >> w;
if(h == 1 && w == 1) {
cout << "! 1 1" << endl;
return 0;
}
if(h == 1) {
cout << "? 1 1" << endl;
int ans;
cin >> ans;
cout << "! 1 " << round(sqrt(ans))+1 << endl;
}
if(w == 1) {
cout << "? 1 1" << endl;
int ans;
cin >> ans;
cout << "! " << round(sqrt(ans))+1 << " 1" << endl;
}
int ans1, ans2;
cout << "? 1 1" << endl;
cin >> ans1;
cout << "? 1 " << w << endl;
cin >> ans2;
rep(i, h) {
rep(j, w) {
if(i * i + j * j == ans1 && i * i + (w-1-j) * (w-1-j) == ans2) {
cout << "! " << i+1 << " " << j+1 << endl;
return 0;
}
}
}
}