Submission #148159

#TimeUsernameProblemLanguageResultExecution timeMemory
148159mosiashvililukaCarnival (CEOI14_carnival)C++14
100 / 100
28 ms396 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,f[159],z,x,dp[159],k[3]; long long taim,bhb; pair <int, int> p[3]; long long nicerand(){ long long isesarandomod=4534; taim++; long long hji=rand()*rand(),hh; hji+=isesarandomod%23; hji%=7; while(hji>0){ hji--; rand(); } hji=0;hh=1;long long ha=0; while(ha<8){ if(rand()%2==1) hji+=hh; hh*=2; ha++; } taim=taim%1000000000000000LL; if(taim==0) taim=1; long long hi=rand()%432+1; hji+=taim*hi; hji%=bhb; hji++; return hji; } int rec(int q, int w){ if(q==w) return f[q]; bhb=4; long long jj=nicerand()*nicerand()%2; if(jj==0){ p[1].first=q;p[1].second=(q+w)/2; p[2].first=(q+w)/2+1;p[2].second=w; }else{ p[2].first=q;p[2].second=(q+w)/2; p[1].first=(q+w)/2+1;p[1].second=w; } k[1]=p[1].second-p[1].first+1; k[2]=p[2].second-p[2].first+1; for(int h=1; h<=2; h++){ cout<<k[h]<<" "; for(int sd=p[h].first; sd<=p[h].second; sd++){ cout<<sd<<" "; } cout<<endl; cin>>z; cout<<endl; x=z; cout<<k[h]+1<<" "; cout<<b<<" "; for(int sd=p[h].first; sd<=p[h].second; sd++){ cout<<sd<<" "; } cout<<endl; cin>>z; cout<<endl; if(z==x){ return rec(p[h].first,p[h].second); } } } int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a; for(b=a; b>=1; b--){ cout<<a-b+1<<" "; for(c=b; c<=a; c++) cout<<c<<" "; cout<<endl; cin>>z; cout<<endl; dp[b]=z; } f[a]=1; e=1; for(b=a-1; b>=1; b--){ if(dp[b]==dp[b+1]){ f[b]=rec(b+1,a); }else{ e++; f[b]=e; } } cout<<"0 "; for(b=1; b<=a; b++) cout<<f[b]<<" "; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int rec(int, int)':
carnival.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...