結果

問題 No.2502 Optimization in the Dark
ユーザー nono00nono00
提出日時 2023-10-13 23:16:25
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,309 bytes
コンパイル時間 3,154 ms
コンパイル使用メモリ 247,004 KB
実行使用メモリ 24,360 KB
平均クエリ数 4.00
最終ジャッジ日時 2023-10-13 23:16:35
合計ジャッジ時間 7,024 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
24,024 KB
testcase_01 AC 25 ms
23,940 KB
testcase_02 AC 25 ms
23,676 KB
testcase_03 AC 24 ms
24,312 KB
testcase_04 AC 25 ms
23,904 KB
testcase_05 AC 27 ms
23,436 KB
testcase_06 AC 25 ms
23,400 KB
testcase_07 AC 25 ms
23,556 KB
testcase_08 AC 25 ms
23,268 KB
testcase_09 AC 25 ms
23,436 KB
testcase_10 AC 25 ms
24,036 KB
testcase_11 AC 26 ms
23,532 KB
testcase_12 AC 25 ms
24,300 KB
testcase_13 AC 24 ms
24,192 KB
testcase_14 AC 25 ms
24,192 KB
testcase_15 AC 25 ms
24,156 KB
testcase_16 AC 25 ms
23,544 KB
testcase_17 AC 26 ms
23,640 KB
testcase_18 AC 25 ms
23,664 KB
testcase_19 AC 25 ms
24,180 KB
testcase_20 AC 25 ms
23,436 KB
testcase_21 AC 24 ms
24,312 KB
testcase_22 AC 25 ms
23,388 KB
testcase_23 AC 25 ms
23,952 KB
testcase_24 AC 25 ms
23,544 KB
testcase_25 AC 26 ms
23,304 KB
testcase_26 AC 25 ms
24,300 KB
testcase_27 AC 25 ms
24,036 KB
testcase_28 AC 26 ms
23,556 KB
testcase_29 AC 26 ms
23,832 KB
testcase_30 AC 26 ms
23,268 KB
testcase_31 AC 26 ms
24,360 KB
testcase_32 AC 24 ms
23,928 KB
testcase_33 AC 25 ms
23,268 KB
testcase_34 AC 26 ms
23,844 KB
testcase_35 AC 25 ms
24,168 KB
testcase_36 AC 24 ms
23,388 KB
testcase_37 AC 25 ms
23,688 KB
testcase_38 AC 25 ms
23,568 KB
testcase_39 AC 24 ms
23,412 KB
testcase_40 AC 25 ms
24,024 KB
testcase_41 AC 26 ms
24,180 KB
testcase_42 AC 26 ms
23,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

namespace nono {

struct Init {};

void solve([[maybe_unused]] const Init& init) {
    int n;
    std::cin >> n;

    auto request = [](int i, int x, int j, int y) {
        std::cout << "? " << i << ' ' << x << ' ' << j << ' ' << y << std::endl;
    };

    auto response = []() {
        std::string s;
        std::cin >> s;
        return s;
    };

    std::vector<int> index(3);
    std::iota(index.begin(), index.end(), 1);
    request(index[0], 2 * n, index[1], 2 * n);
    if (response() == "No") {
        std::swap(index[0], index[1]);
    }
    request(index[1], 2 * n, index[2], 2 * n);
    if (response() == "No") {
        std::swap(index[1], index[2]);
    }

    request(index[0], n, index[1], n);
    if (response() == "Yes") {
        std::swap(index[0], index[1]);
    }

    std::cout << "! ";
    for (int i = 0; i < n; i++) {
        std::cout << index[0] << ' ' << index[2] << ' ';
    }
    for (int i = 0; i < n; i++) {
        std::cout << index[1] << ' ' << index[2] << ' ';
    }
    for (int i = 0; i < n; i++) {
        std::cout << index[0] << ' ' << index[1] << (i + 1 == n ? '\n' : ' ');
    }
}

}  //  namespace nono

int main() {
    std::cin.tie(0)->sync_with_stdio(0);

    int t = 1;
    nono::Init init;

    while (t--) nono::solve(init);
}
0