Submission #210112

# Submission time Handle Problem Language Result Execution time Memory
210112 2020-03-16T14:57:08 Z Utaha Zagonetka (COI18_zagonetka) C++14
0 / 100
52 ms 376 KB
/*input
6 9
5 4 1 3 3 3
3 1
3 5
4 3
4 2
2 6
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (int)(lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
    out<<'('<<P.F<<','<<P.S<<')';
    return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
    REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
    return out;
}
//}}}
const ll maxn=205;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}

int n;
int p[maxn];

int solve(vector<int> q){
    cout<<"query";
    for(int i:q) cout<<' '<<1+i;
    cout<<endl;
    int ret;
    cin>>ret;
    return ret;
}

vector<int> mn,mx;

int main(){
    IOS;
    cin>>n;
    REP(i,n) cin>>p[i];
    REP(i,n) p[i]--;

    {
        bool vis[maxn]={0};
        vector<int> ans;
        REP(i,n){
            for(int j=0;j<n;j++) if(!vis[j]){
                vis[j]=1;
                vector<int> q=ans;
                q.pb(j);
                REP(t,n) if(!vis[p[t]]) q.pb(p[t]);
                int res=(i==n-1)?1:solve(q);
                if(res==1){
                    ans.pb(j);
                    break;
                }
                vis[j]=0;
            }
        }
        mn=ans;
        REP(i,n) mn[i]++;
    }
    {
        bool vis[maxn]={0};
        vector<int> ans;
        REP(i,n){
            for(int j=n-1;j>=0;j--) if(!vis[j]){
                vis[j]=1;
                vector<int> q=ans;
                q.pb(j);
                REP(t,n) if(!vis[p[t]]) q.pb(p[t]);
                int res=(i==n-1)?1:solve(q);
                if(res==1){
                    ans.pb(j);
                    break;
                }
                vis[j]=0;
            }
        }
        mx=ans;
        REP(i,n) mx[i]++;
    }
    cout<<"end"<<endl;
    cout<<mn<<endl;
    cout<<mx<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Incorrect 5 ms 248 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -