結果
問題 | No.2502 Optimization in the Dark |
ユーザー |
👑 ![]() |
提出日時 | 2023-07-25 17:53:28 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,588 bytes |
コンパイル時間 | 915 ms |
コンパイル使用メモリ | 81,408 KB |
実行使用メモリ | 25,808 KB |
平均クエリ数 | 4.00 |
最終ジャッジ日時 | 2024-09-15 16:07:02 |
合計ジャッジ時間 | 4,256 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 WA * 13 |
ソースコード
#include <array>#include <cassert>#include <iostream>#include <string>#include <utility>// <不定> #895160 ベース// i と j を逆に選択している。int main() {constexpr int kMaxN = 100;int n;std::cin >> n;assert(1 <= n && n <= kMaxN);const auto Query = [n](const int i, const int x, const int j, const int y)-> bool {assert(1 <= i && i <= 3 && 1 <= x && x <= n * 2 &&1 <= j && j <= 3 && 1 <= y && y <= n * 2);std::cout << "? " << i << ' ' << x << ' ' << j << ' ' << y << std::endl;std::string answer;std::cin >> answer;assert(answer == "Yes" || answer == "No");return answer == "Yes";};int largest_deck = 1;for (int i = 2; i <= 3; ++i) {if (Query(largest_deck, n * 2, i, n * 2)) largest_deck = i;}int smaller_deck = 0;for (int i = 1; i <= 3; ++i) {if (i == largest_deck) continue;for (int j = i + 1; j <= 3; ++j) {if (j != largest_deck) {smaller_deck = (Query(i, n, j, n) ? j : i); // ここbreak;}}}assert(1 <= smaller_deck && smaller_deck <= 3);const int another_deck = largest_deck ^ smaller_deck;std::cout << '!';for (const auto& [i, j]: std::array<std::pair<int, int>, 3>{std::make_pair(largest_deck, another_deck),std::make_pair(largest_deck, smaller_deck),std::make_pair(another_deck, smaller_deck)}) {assert(i != j);for (int turn = 1; turn <= n; ++turn) {std::cout << ' ' << i << ' ' << j;}}std::cout << std::endl;return 0;}