結果
問題 | No.2502 Optimization in the Dark |
ユーザー | 👑 emthrm |
提出日時 | 2023-07-25 17:53:28 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,588 bytes |
コンパイル時間 | 717 ms |
コンパイル使用メモリ | 80,892 KB |
実行使用メモリ | 105,120 KB |
平均クエリ数 | 4.00 |
最終ジャッジ日時 | 2023-10-13 20:31:08 |
合計ジャッジ時間 | 4,225 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 26 ms
23,784 KB |
testcase_02 | AC | 26 ms
24,000 KB |
testcase_03 | AC | 25 ms
23,496 KB |
testcase_04 | AC | 26 ms
23,496 KB |
testcase_05 | AC | 25 ms
23,484 KB |
testcase_06 | AC | 26 ms
24,216 KB |
testcase_07 | AC | 26 ms
23,580 KB |
testcase_08 | AC | 26 ms
23,784 KB |
testcase_09 | AC | 27 ms
24,192 KB |
testcase_10 | AC | 27 ms
23,592 KB |
testcase_11 | AC | 26 ms
23,484 KB |
testcase_12 | AC | 25 ms
23,868 KB |
testcase_13 | AC | 26 ms
23,268 KB |
testcase_14 | AC | 27 ms
23,592 KB |
testcase_15 | AC | 27 ms
23,532 KB |
testcase_16 | AC | 26 ms
24,240 KB |
testcase_17 | AC | 26 ms
23,544 KB |
testcase_18 | AC | 26 ms
23,856 KB |
testcase_19 | AC | 25 ms
24,120 KB |
testcase_20 | AC | 25 ms
23,364 KB |
testcase_21 | AC | 26 ms
23,268 KB |
testcase_22 | AC | 25 ms
23,328 KB |
testcase_23 | AC | 25 ms
23,256 KB |
testcase_24 | AC | 26 ms
23,424 KB |
testcase_25 | AC | 24 ms
23,292 KB |
testcase_26 | AC | 26 ms
23,280 KB |
testcase_27 | AC | 25 ms
23,880 KB |
testcase_28 | AC | 25 ms
23,868 KB |
testcase_29 | AC | 25 ms
23,328 KB |
testcase_30 | AC | 25 ms
24,240 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
ソースコード
#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; }