結果

問題 No.2502 Optimization in the Dark
ユーザー baluteshih
提出日時 2023-10-13 22:22:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 986 bytes
コンパイル時間 1,989 ms
コンパイル使用メモリ 194,776 KB
最終ジャッジ日時 2025-02-17 07:22:13
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(), v.end()
#define pb push_back

int query(int a, int x, int b, int y) {
    cout << "? " << a << " " << x << " " << b << " " << y << endl;
    string s;
    cin >> s;
    return s == "Yes";
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    int arr[3] = {1, 2, 3};
    for (int i = 0; i < 2; ++i)
        if (!query(arr[i], 2 * n, arr[i + 1], 2 * n))
            swap(arr[i], arr[i + 1]);
    if (!query(arr[0], n, arr[1], n))
        swap(arr[0], arr[1]);
    cout << "!";
    for (int i = 0; i < n; ++i)
        cout << " " << arr[1] << " " << arr[2];
    for (int i = 0; i < n; ++i)
        cout << " " << arr[0] << " " << arr[2];
    for (int i = n + 1; i <= 2 * n; ++i)
        cout << " " << arr[0] << " " << arr[1];
    cout << endl;
}
0