結果
問題 |
No.3018 目隠し宝探し
|
ユーザー |
|
提出日時 | 2025-03-07 01:46:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 1,020 bytes |
コンパイル時間 | 2,158 ms |
コンパイル使用メモリ | 192,576 KB |
実行使用メモリ | 26,108 KB |
平均クエリ数 | 2.68 |
最終ジャッジ日時 | 2025-03-07 01:46:47 |
合計ジャッジ時間 | 5,749 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (ll i = m; i < n; i++) #define FORR(i, m, n) for (ll i = m; i >= n; i--) #define REPO(i, n) for (ll i = 1; i <= n; i++) #define ll long long #define INF (ll)1ll << 60 #define MINF (-1 * INF) #define ALL(n) n.begin(), n.end() #define MOD (ll)1000000007 #define P pair<ll, ll> int main(){ ll h, w; cin >> h >> w; if(h == 1 and w == 1){ cout << "! 1 1" << endl; } else if(h == 1){ ll a; cout << "? 1 1" << endl; cin >> a; cout <<"! " << 1 <<" " << sqrt(a) + 1 <<endl; } else if(w == 1){ ll a; cout << "? 1 1" << endl; cin >> a; cout <<"! " << sqrt(a) + 1 <<" " << 1 <<endl; } else { ll a, b; cout << "? 1 1" << endl; cin >> a; cout << "? 1 2" << endl; cin >> b; ll y = (a - b + 3) / 2; ll x = sqrt(a - (y - 1) * (y - 1)) + 1; cout <<"! " << x <<" " << y <<endl; } }