結果
問題 | No.3018 目隠し宝探し |
ユーザー |
![]() |
提出日時 | 2025-01-25 15:52:50 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,449 bytes |
コンパイル時間 | 6,707 ms |
コンパイル使用メモリ | 253,880 KB |
実行使用メモリ | 25,984 KB |
平均クエリ数 | 2.68 |
最終ジャッジ日時 | 2025-01-25 23:49:27 |
合計ジャッジ時間 | 9,607 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 18 WA * 3 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:68:20: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized] 68 | tmp1 -= (x - 1) * (x - 1); | ~~~^~~~ main.cpp:54:13: note: 'x' was declared here 54 | int x, y; | ^
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int H, W;cin >> H >> W;if (H * W == 1){cout << "! 1 1" << endl;return 0;}cout << "? 1 1" << endl;int tmp1;cin >> tmp1;if (tmp1 == 0){cout << "! 1 1" << endl;return 0;}if (H * W == 2){if (H == 1){cout << "! 1 2" << endl;return 0;}else{cout << "! 2 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 << "! " << tmp1 + 1 << " " << x << endl;return 0;}}