結果
問題 |
No.3018 目隠し宝探し
|
ユーザー |
![]() |
提出日時 | 2025-01-25 15:45:12 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,139 bytes |
コンパイル時間 | 7,149 ms |
コンパイル使用メモリ | 254,312 KB |
実行使用メモリ | 26,356 KB |
平均クエリ数 | 2.73 |
最終ジャッジ日時 | 2025-01-25 23:48:00 |
合計ジャッジ時間 | 9,586 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 2 WA * 19 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:50:20: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized] 50 | tmp1 -= (x - 1) * (x - 1); | ~~~^~~~ main.cpp:36:13: note: 'x' was declared here 36 | int x, y; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int H, W; cin >> H >> W; cout << "? 1 1" << endl; int tmp1; cin >> tmp1; if (tmp1 == 0) { cout << "! 1 1" << endl; return 0; } if (W == 1) { cout << "? 2 1" << endl; int tmp2; cin >> tmp2; int sa = tmp1 - tmp2; for (int i = 1; i <= H; ++i) { if (i * i - (i - 1) * (i - 1) == sa) { cout << "! " << i + 1 << " 1" << endl; return 0; } } } else { cout << "? 1 2" << endl; int tmp2; cin >> tmp2; int sa = tmp1 - tmp2; int x, y; if (sa < 0) x = 1; else { for (int i = 1; i <= W; ++i) { if (i * i - (i - 1) * (i - 1) == sa) { x = i + 1; break; } } } tmp1 -= (x - 1) * (x - 1); tmp1 = sqrt(tmp1); cout << "! " << x << " " << tmp1 << endl; return 0; } }