結果

問題 No.2502 Optimization in the Dark
ユーザー suisensuisen
提出日時 2023-07-26 18:46:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 984 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 69,432 KB
実行使用メモリ 24,396 KB
平均クエリ数 4.00
最終ジャッジ日時 2023-10-13 20:31:13
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
23,556 KB
testcase_01 AC 25 ms
23,904 KB
testcase_02 AC 26 ms
23,424 KB
testcase_03 AC 27 ms
24,096 KB
testcase_04 AC 27 ms
23,592 KB
testcase_05 AC 27 ms
23,868 KB
testcase_06 AC 26 ms
23,976 KB
testcase_07 AC 25 ms
23,532 KB
testcase_08 AC 26 ms
23,676 KB
testcase_09 AC 27 ms
23,808 KB
testcase_10 AC 25 ms
23,952 KB
testcase_11 AC 25 ms
23,604 KB
testcase_12 AC 25 ms
24,000 KB
testcase_13 AC 25 ms
23,568 KB
testcase_14 AC 26 ms
24,396 KB
testcase_15 AC 27 ms
23,496 KB
testcase_16 AC 26 ms
24,192 KB
testcase_17 AC 25 ms
23,268 KB
testcase_18 AC 26 ms
24,228 KB
testcase_19 AC 25 ms
23,868 KB
testcase_20 AC 25 ms
24,192 KB
testcase_21 AC 25 ms
23,952 KB
testcase_22 AC 27 ms
23,544 KB
testcase_23 AC 26 ms
23,904 KB
testcase_24 AC 26 ms
23,292 KB
testcase_25 AC 26 ms
23,280 KB
testcase_26 AC 26 ms
24,228 KB
testcase_27 AC 25 ms
23,604 KB
testcase_28 AC 25 ms
23,844 KB
testcase_29 AC 27 ms
23,688 KB
testcase_30 AC 25 ms
23,580 KB
testcase_31 AC 26 ms
23,340 KB
testcase_32 AC 26 ms
23,508 KB
testcase_33 AC 26 ms
23,364 KB
testcase_34 AC 26 ms
23,904 KB
testcase_35 AC 26 ms
23,328 KB
testcase_36 AC 27 ms
23,340 KB
testcase_37 AC 25 ms
23,868 KB
testcase_38 AC 25 ms
23,808 KB
testcase_39 AC 25 ms
23,784 KB
testcase_40 AC 27 ms
24,240 KB
testcase_41 AC 25 ms
23,472 KB
testcase_42 AC 26 ms
23,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 {
        return false;
    }
}
void output_answer(int n, int i, int j, int k) {
    std::cout << "!";
    for (int t = 0; t < n; ++t) std::cout << ' ' << i << ' ' << k;
    for (int t = 0; t < n; ++t) std::cout << ' ' << j << ' ' << k;
    for (int t = 0; t < n; ++t) std::cout << ' ' << i << ' ' << j;
    std::cout << '\n', std::cout.flush();
}

int main() {
    int n;
    std::cin >> n;

    int i, j, k;
    if (query(1, 2 * n, 2, 2 * n)) {
        i = 1, j = 3, k = 2;
    } else {
        i = 2, j = 3, k = 1;
    }
    if (query(k, 2 * n, 3, 2 * n)) {
        std::swap(j, k);
    }
    if (query(i, n, j, n)) {
        std::swap(i, j);
    }
    output_answer(n, i, j, k);

    return 0;
}
0