Submission #244848

#TimeUsernameProblemLanguageResultExecution timeMemory
244848uacoder123Carnival (CEOI14_carnival)C++14
0 / 100
11 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i) #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) #define mp(i,a) make_pair(i,a) #define pb(a) push_back(a) #define bit(x,b) (x&(1LL<<b)) typedef int lli; typedef pair <lli,lli> ii; typedef pair <lli,ii> iii; typedef vector <lli> vi; vi v; int qu(int s,int e,int ex) { cout<<e-s+2<<' '; for(int i=s;i<=e;++i) cout<<v[i]<<' '; cout<<ex<<endl; int ans; cin>>ans; return(ans); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); lli test=1; for(;test>0;--test) { int n,x=1,c=1; cin>>n; vi arr(n+1); arr[1]=x; x++; v.pb(1); for(int i=2;i<=n;++i) { int g=qu(0,v.size()-1,i); if(c==g-1) { v.pb(i); arr[i]=x; x++; c++; } else { int l=0,r=v.size()-1,ans=-1; while(l<=r) { int m=(l+r)/2; if(qu(l,m,i)==(m-l+1)) { ans=m; l=m+1; } else r=m-1; } arr[i]=arr[v[ans]]; } } cout<<0<<' '; for(int i=1;i<=n;++i) cout<<arr[i]<<' '; cout<<endl; } return(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...