Submission #1092381

#TimeUsernameProblemLanguageResultExecution timeMemory
1092381Saul0906Carnival (CEOI14_carnival)C++14
0 / 100
1 ms344 KiB
#include <bits/stdc++.h> #define pii pair<int,int> #define pll pair<ll,ll> #define fi first #define se second //#define endl "\n" #define rep(a,b,c) for(ll a=b; a<c; a++) #define rep2(a,b,c,d) for(ll a=b; a<c; a+=d) #define repr(a,b,c) for(ll a=b-1; a>c-1; a--) #define repa(a,b) for(const auto &a: b) #define multicase() int t; cin>>t; while(t--) #define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define valid(c) cout<<(c ? "YES" : "NO")<<endl; #define valid2(c,a,b) cout<<(c ? a : b)<<endl; #define ll long long #define pq_min(a) priority_queue<a, vector<a>, greater<a>> #define pq_max(a) priority_queue<a> #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define mid ((l+r)>>1) #define flush endl<<flush; using namespace std; int query(int l, int r, int z=0){ cout<<r-l+(z>0); rep(i,l,r+1) cout<<" "<<i; if(z) cout<<" "<<z; cout<<endl; cin>>l; return l; } bool ask(int l, int r, int z){ int x=query(l,r), y=query(l,r,z); return x==y; } int main(){ fastIO(); int n; cin>>n; int a[n+1]{}, c=1, l, r; a[1]=1; rep(i,2,n+1){ l=1, r=i-1; if(!ask(l,r,i)){ a[i]=++c; continue; } while(l<r){ if(ask(l,mid,i)) r=mid; else l=mid+1; } a[i]=a[l]; } rep(i,0,n+1) cout<<a[i]<<" "; cout<<endl; }
#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...