結果
問題 |
No.3161 Find Presents
|
ユーザー |
![]() |
提出日時 | 2025-05-23 20:20:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,235 bytes |
コンパイル時間 | 1,265 ms |
コンパイル使用メモリ | 120,620 KB |
実行使用メモリ | 26,216 KB |
平均クエリ数 | 8002.00 |
最終ジャッジ日時 | 2025-05-23 20:21:00 |
合計ジャッジ時間 | 27,518 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 80 |
ソースコード
#include <iostream> #include <iomanip>//小数点出力用 //cout << fixed << setprecision(10) << ans; #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <set> #include <unordered_set> #include <map> using ll = long long; using namespace std; #define modP7 1'000'000'007 #define modP 998244353 bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); } int clk4(int num) { return (num - 2) * (num % 2); } void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); } int main() { stack<pair<pair<int,int>,pair<int,int>>>S; S.push({ {0,50000},{0,50000} }); S.push({ {0,50000},{50001, 100000} }); S.push({ {50001,100000},{0,50000} }); S.push({ {50001,100000},{50001, 100000} }); vector<pair<int, int >> ans; while (!S.empty()) { cout << "? " << S.top().first.first << " " << S.top().first.second << " " << S.top().second.first << " " << S.top().second.second << endl; int r; cin >> r; if (r == 1) { if (S.top().first.first == S.top().first.second && S.top().second.first == S.top().second.second) { ans.push_back({ S.top().first.first ,S.top().second.first }); } else { S.push({ {S.top().first.first,(S.top().first.first + S.top().first.second) / 2},{S.top().second.first,(S.top().second.first + S.top().second.second) / 2} }); S.push({ {S.top().first.first,(S.top().first.first + S.top().first.second) / 2},{(S.top().second.first + S.top().second.second) / 2 + 1, S.top().second.second} }); S.push({ {(S.top().first.first + S.top().first.second) / 2 + 1, S.top().first.second},{S.top().second.first,(S.top().second.first + S.top().second.second) / 2} }); S.push({ {(S.top().first.first + S.top().first.second) / 2 + 1, S.top().first.second},{(S.top().second.first + S.top().second.second) / 2 + 1, S.top().second.second} }); } } else if (r == -1) { cout << "death"; return 0; } } cout << "! " << ans.size() << endl; for (int i = 0;i < ans.size();i++) { cout << ans[i].first << " " << ans[i].second << endl; } return 0; }