結果

問題 No.2502 Optimization in the Dark
ユーザー suisensuisen
提出日時 2023-01-12 15:33:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,349 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 70,584 KB
実行使用メモリ 24,540 KB
平均クエリ数 4.00
最終ジャッジ日時 2023-10-13 20:30:14
合計ジャッジ時間 4,135 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 26 ms
23,292 KB
testcase_02 AC 26 ms
24,240 KB
testcase_03 AC 26 ms
23,520 KB
testcase_04 AC 26 ms
23,424 KB
testcase_05 AC 26 ms
23,904 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 27 ms
24,228 KB
testcase_09 AC 27 ms
23,880 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 27 ms
23,868 KB
testcase_13 AC 26 ms
24,024 KB
testcase_14 AC 27 ms
23,280 KB
testcase_15 WA -
testcase_16 AC 27 ms
23,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 27 ms
23,268 KB
testcase_20 AC 26 ms
24,240 KB
testcase_21 AC 26 ms
23,628 KB
testcase_22 WA -
testcase_23 AC 27 ms
23,292 KB
testcase_24 AC 27 ms
24,240 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 26 ms
23,532 KB
testcase_28 WA -
testcase_29 AC 26 ms
23,652 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 26 ms
23,880 KB
testcase_33 WA -
testcase_34 AC 26 ms
24,024 KB
testcase_35 AC 27 ms
23,280 KB
testcase_36 AC 27 ms
24,024 KB
testcase_37 WA -
testcase_38 AC 27 ms
23,532 KB
testcase_39 WA -
testcase_40 AC 27 ms
24,120 KB
testcase_41 AC 27 ms
23,268 KB
testcase_42 AC 27 ms
23,892 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 if (response == "No") {
        return false;
    } else {
        assert(false);
    }
}
void output_answer(int n, int i1, int j1, int i2, int j2, int i3, int j3) {
    std::cout << "!";
    for (int i = 0; i < n; ++i) std::cout << ' ' << i1 << ' ' << j1;
    for (int i = 0; i < n; ++i) std::cout << ' ' << i2 << ' ' << j2;
    for (int i = 0; i < n; ++i) std::cout << ' ' << i3 << ' ' << j3;
    std::cout.flush();
}

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

    int i3, j3, i2, j2, i1, j1;

    bool q1 = query(2, 2 * n, 3, 2 * n);
    if (q1) {
        bool q2 = query(1, 2 * n, 3, 2 * n);
        if (q2) {
            i3 = 1, j3 = 1;
        } else {
            i3 = 2, j3 = 3;
        }
    } else {
        bool q2 = query(1, 2 * n, 2, 2 * n);
        if (q2) {
            i3 = 1, j3 = 3;
        } else {
            i3 = 2, j3 = 3;
        }
    }
    i2 = i3 ^ j3;
    bool q3 = query(i3, n, j3, n);
    if (q3) {
        j2 = i3;
    } else {
        j2 = j3;
    }
    i1 = i2, j1 = j2 ^ i3 ^ j3;

    output_answer(n, i1, j1, i2, j2, i3, j3);
}
0