結果

問題 No.2502 Optimization in the Dark
ユーザー HaaHaa
提出日時 2023-10-13 23:03:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 1,299 bytes
コンパイル時間 1,656 ms
コンパイル使用メモリ 169,352 KB
実行使用メモリ 24,360 KB
平均クエリ数 4.00
最終ジャッジ日時 2023-10-13 23:03:25
合計ジャッジ時間 5,336 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
23,664 KB
testcase_01 AC 26 ms
23,376 KB
testcase_02 AC 25 ms
23,652 KB
testcase_03 AC 24 ms
23,532 KB
testcase_04 AC 24 ms
24,024 KB
testcase_05 AC 23 ms
23,364 KB
testcase_06 AC 24 ms
23,400 KB
testcase_07 AC 23 ms
23,532 KB
testcase_08 AC 24 ms
23,604 KB
testcase_09 AC 26 ms
23,940 KB
testcase_10 AC 26 ms
23,364 KB
testcase_11 AC 23 ms
24,336 KB
testcase_12 AC 23 ms
23,616 KB
testcase_13 AC 24 ms
24,036 KB
testcase_14 AC 24 ms
24,204 KB
testcase_15 AC 23 ms
23,388 KB
testcase_16 AC 24 ms
24,228 KB
testcase_17 AC 23 ms
23,640 KB
testcase_18 AC 24 ms
23,640 KB
testcase_19 AC 23 ms
24,000 KB
testcase_20 AC 23 ms
23,808 KB
testcase_21 AC 24 ms
23,640 KB
testcase_22 AC 25 ms
24,012 KB
testcase_23 AC 24 ms
24,360 KB
testcase_24 AC 24 ms
23,412 KB
testcase_25 AC 26 ms
23,520 KB
testcase_26 AC 24 ms
23,388 KB
testcase_27 AC 24 ms
24,000 KB
testcase_28 AC 24 ms
23,988 KB
testcase_29 AC 23 ms
23,820 KB
testcase_30 AC 24 ms
24,048 KB
testcase_31 AC 24 ms
24,300 KB
testcase_32 AC 23 ms
23,376 KB
testcase_33 AC 24 ms
24,360 KB
testcase_34 AC 24 ms
24,300 KB
testcase_35 AC 22 ms
23,508 KB
testcase_36 AC 25 ms
23,388 KB
testcase_37 AC 24 ms
23,796 KB
testcase_38 AC 23 ms
23,352 KB
testcase_39 AC 24 ms
23,616 KB
testcase_40 AC 24 ms
23,940 KB
testcase_41 AC 22 ms
23,364 KB
testcase_42 AC 24 ms
23,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T& x, const T& y){return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T& x, const T& y){return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;

bool ask(int i, int x, int j, int y){
    cout << "? ";
    cout << i+1 << " " << x+1 << " ";
    cout << j+1 << " " << y+1 << endl;
    string ret;
    cin >> ret;
    return ret=="Yes";
}

int main(){
    int n; cin >> n;
    int mx=0;
    for(int i=1;i<=2;i++){
        if(ask(mx,n*2-1,i,n*2-1))
            mx=i;
    }
    int l=-1, r=-1;
    REP(i,3){
        if(i==mx)
            continue;
        if(l==-1)
            l=i;
        else
            r=i;
    }
    if(ask(r,n-1,l,n-1))
        swap(l,r);
    VI ansl, ansr;
    REP(i,n){
        ansl.push_back(mx);
        ansr.push_back(r);
    }
    REP(i,n){
        ansl.push_back(mx);
        ansr.push_back(l);
    }
    REP(i,n){
        ansl.push_back(l);
        ansr.push_back(r);
    }
    cout << "!";
    REP(i,n*3) cout << " " << ansl[i]+1 << " " << ansr[i]+1;
    cout << endl;
    return 0;
}
0