結果
| 問題 |
No.3161 Find Presents
|
| コンテスト | |
| ユーザー |
Cafe1942
|
| 提出日時 | 2025-05-23 20:31:38 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,606 bytes |
| コンパイル時間 | 1,245 ms |
| コンパイル使用メモリ | 120,520 KB |
| 実行使用メモリ | 26,236 KB |
| 平均クエリ数 | 3142.26 |
| 最終ジャッジ日時 | 2025-05-23 20:31:56 |
| 合計ジャッジ時間 | 16,123 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 76 |
ソースコード
#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"); }
#define top front
int main() {
queue<pair<pair<int,int>,pair<int,int>>>S;
S.push({ {0,500000},{0,500000} });
S.push({ {0,500000},{500001, 1000000} });
S.push({ {500001,1000000},{0,500000} });
S.push({ {500001,1000000},{500001, 1000000} });
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} });
if ((S.top().second.first + S.top().second.second) / 2 + 1 < S.top().second.second)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} });
if ((S.top().first.first + S.top().first.second) / 2 + 1 < S.top().first.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} });
if ((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)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;
}
S.pop();
}
cout << "! " << ans.size() << endl;
for (int i = 0;i < ans.size();i++) {
cout << ans[i].first << " " << ans[i].second << endl;
}
return 0;
}
Cafe1942