結果
問題 |
No.3018 目隠し宝探し
|
ユーザー |
![]() |
提出日時 | 2025-01-25 16:30:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,459 bytes |
コンパイル時間 | 3,052 ms |
コンパイル使用メモリ | 275,888 KB |
実行使用メモリ | 25,984 KB |
平均クエリ数 | 2.68 |
最終ジャッジ日時 | 2025-01-25 23:52:56 |
合計ジャッジ時間 | 6,299 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include <debug.hpp> #else #define debug(...) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); int H, W; cin >> H >> W; if (H == 1 && W == 1) { cout << "! " << H << " " << W << endl; } else if (H == 1) { cout << "? " << 1 << " " << 1 << endl; int d; cin >> d; for (int w = 1; w <= W; w++) { if ((w - 1) * (w - 1) == d) { cout << "! " << 1 << " " << w + 1 << endl; return 0; } } } else if (W == 1) { cout << "? " << 1 << " " << 1 << endl; int d; cin >> d; for (int h = 1; h <= H; h++) { if ((h - 1) * (h - 1) == d) { cout << "! " << h << " " << 1 << endl; return 0; } } } else { cout << "? " << 1 << " " << 1 << endl; int d1; cin >> d1; cout << "? " << 1 << " " << W << endl; int d2; cin >> d2; for (int h = 1; h <= H; h++) { for (int w = 1; w <= W; w++) { if ((h - 1) * (h - 1) + (w - 1) * (w - 1) != d1) continue; if ((h - 1) * (h - 1) + (W - w) * (W - w) != d2) continue; cout << "! " << h << " " << w << endl; return 0; } } } }