結果

問題 No.2502 Optimization in the Dark
ユーザー Rubikun
提出日時 2023-10-13 21:31:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,387 bytes
コンパイル時間 1,848 ms
コンパイル使用メモリ 201,048 KB
最終ジャッジ日時 2025-02-17 07:07:52
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

int main(){
    
    int N;cin>>N;
    vector<pair<int,int>> ask;
    vector<int> res;
    
    for(int a=1;a<=3;a++){
        for(int b=a+1;b<=3;b++){
            cout<<"?"<<" "<<a<<" "<<2*N<<" "<<b<<" "<<2*N<<endl;
            string S;cin>>S;
            ask.push_back(mp(a-1,b-1));
            if(S=="Yes") res.push_back(1);
            else res.push_back(0);
        }
    }
    
    vector<int> P={1,2,3};
    
    do{
        bool ok=true;
        for(int t=0;t<3;t++){
            if(res[t]==1){
                ok&=(P[ask[t].fi]<P[ask[t].se]);
            }else{
                ok&=(P[ask[t].fi]>=P[ask[t].se]);
            }
        }
        
        if(!ok) continue;
        
        cout<<"!";
        for(int i=1;i<=N;i++) cout<<" "<<P[1]<<" "<<P[2];
        for(int i=1;i<=N;i++) cout<<" "<<P[0]<<" "<<P[2];
        for(int i=1;i<=N;i++) cout<<" "<<P[0]<<" "<<P[1];
        cout<<endl;
        return 0;
    }while(next_permutation(all(P)));
}
0