#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=0;
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
carnival.cpp: In function 'int rec(int, int)':
carnival.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
248 KB |
Output is correct |
2 |
Correct |
21 ms |
376 KB |
Output is correct |
3 |
Correct |
13 ms |
248 KB |
Output is correct |
4 |
Correct |
6 ms |
248 KB |
Output is correct |
5 |
Correct |
26 ms |
376 KB |
Output is correct |
6 |
Correct |
23 ms |
376 KB |
Output is correct |
7 |
Correct |
24 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
376 KB |
Output is correct |
2 |
Correct |
31 ms |
248 KB |
Output is correct |
3 |
Correct |
11 ms |
376 KB |
Output is correct |
4 |
Correct |
7 ms |
248 KB |
Output is correct |
5 |
Correct |
15 ms |
248 KB |
Output is correct |
6 |
Correct |
16 ms |
248 KB |
Output is correct |
7 |
Correct |
27 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
248 KB |
Output is correct |
2 |
Correct |
31 ms |
248 KB |
Output is correct |
3 |
Correct |
24 ms |
376 KB |
Output is correct |
4 |
Correct |
7 ms |
248 KB |
Output is correct |
5 |
Correct |
19 ms |
248 KB |
Output is correct |
6 |
Correct |
19 ms |
248 KB |
Output is correct |
7 |
Correct |
15 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
248 KB |
Output is correct |
2 |
Correct |
26 ms |
376 KB |
Output is correct |
3 |
Correct |
10 ms |
248 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
20 ms |
376 KB |
Output is correct |
6 |
Correct |
15 ms |
376 KB |
Output is correct |
7 |
Correct |
25 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
248 KB |
Output is correct |
2 |
Correct |
27 ms |
252 KB |
Output is correct |
3 |
Correct |
19 ms |
248 KB |
Output is correct |
4 |
Correct |
14 ms |
248 KB |
Output is correct |
5 |
Correct |
10 ms |
380 KB |
Output is correct |
6 |
Correct |
12 ms |
248 KB |
Output is correct |
7 |
Correct |
7 ms |
248 KB |
Output is correct |