Submission #469122

#TimeUsernameProblemLanguageResultExecution timeMemory
469122Urvuk3Carnival (CEOI14_carnival)C++17
100 / 100
11 ms312 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int MAXN=155,MAXA=1e6+5,INF=1e9; const double EPS=1e-9; #define fi first #define se second #define pll pair<ll,ll> #define pii pair<int,int> #define mid (l+r)/2 #define sz(a) int((a).size()) #define all(a) a.begin(),a.end() #define mod 1000000007LL #define pb push_back #define PRINT(x) cerr<<#x<<'-'<<x<<endl<<flush; #define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());} #define pb push_back #define pf push_front #define ppf pop_front #define ppb pop_back #define PRINTvec(x) { cerr<<#x<<"-"; for(int i=0;i<sz(x);i++) cerr<<x[i]<<" "; cerr<<endl; } ll n,m,k,q,x,y,z,input,l,r; string s,t; ifstream in; vector<int> dif; vector<int> res; #ifdef ONLINE_JUDGE #define in cin #endif void nadji_razlicite(){ for(int i=1;i<=n;i++){ cout<<sz(dif)+1<<" "<<i<<" "; for(auto v:dif) cout<<v<<" "; cout<<endl; cin>>input; if(input>sz(dif)){ res[i]=input; dif.pb(i); } } } bool check(int pos,int x){ cout<<pos+2<<" "<<x<<" "; for(int i=0;i<=pos;i++) cout<<dif[i]<<" "; cout<<endl; cin>>input; return input<pos+2; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; res.resize(n+1); nadji_razlicite(); for(int i=1;i<=n;i++){ if(res[i]) continue; l=0; r=sz(dif)-1; ll ans=0; while(l<=r){ if(check(mid,i)){ ans=mid; r=mid-1; } else l=mid+1; } res[i]=res[dif[ans]]; } cout<<0<<" "; for(int i=1;i<=n;i++){ cout<<res[i]<<" "; } 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...