結果
| 問題 | No.2502 Optimization in the Dark |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-22 20:37:03 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,036 bytes |
| 記録 | |
| コンパイル時間 | 528 ms |
| コンパイル使用メモリ | 81,388 KB |
| 実行使用メモリ | 30,020 KB |
| 平均クエリ数 | 4.00 |
| 最終ジャッジ日時 | 2026-07-01 21:04:35 |
| 合計ジャッジ時間 | 3,773 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 43 |
ソースコード
#include <cassert>
#include <iostream>
bool query(int i, int x, int j, int y) {
std::cout << "? " << i << ' ' << x << ' ' << j << ' ' << y << '\n', std::cout.flush();
std::string response;
std::cin >> response;
if (response == "Yes") {
return true;
} else if (response == "No") {
return false;
} else {
exit(1);
}
}
void output_answer(int n, int i, int j, int k) {
std::cout << "!";
for (int i = 0; i < n; ++i) std::cout << ' ' << i << ' ' << k;
for (int i = 0; i < n; ++i) std::cout << ' ' << j << ' ' << k;
for (int i = 0; i < n; ++i) std::cout << ' ' << i << ' ' << j;
std::cout << '\n', std::cout.flush();
}
int main() {
int n;
std::cin >> n;
int i, j, k;
if (query(2, 2 * n, 3, 2 * n)) {
i = 1, j = 3, k = 2;
} else {
i = 2, j = 3, k = 1;
}
if (query(k, 2 * n, 2, 2 * n)) {
std::swap(j, k);
}
if (query(i, n, j, n)) {
std::swap(i, j);
}
output_answer(n, i, j, k);
return 0;
}