結果
| 問題 | 
                            No.2502 Optimization in the Dark
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-07-26 18:46:07 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 52 ms / 2,000 ms | 
| コード長 | 984 bytes | 
| コンパイル時間 | 537 ms | 
| コンパイル使用メモリ | 69,680 KB | 
| 最終ジャッジ日時 | 2025-02-15 19:16:42 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 43 | 
ソースコード
#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;
}