Submission #596456

#TimeUsernameProblemLanguageResultExecution timeMemory
596456SummersCarnival (CEOI14_carnival)C++14
100 / 100
9 ms248 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; long long a[10000], r[1000]; int main() { long long i,j,n,le,ri,mid,num=1,ans; cin>>n; a[1]=1;r[1]=1; for(i=2;i<=n;i++) { cout<<num+1; for(j=1;j<=num;j++)cout<<" "<<a[j]; cout<<" "<<i<<endl; cin>>ans; if(ans>num){num++;a[num]=i;r[i]=num;continue;} le=1; ri=num; while(le<=ri) { mid=(le+ri)/2; cout<<mid-le+2; for(j=le;j<=mid;j++)cout<<" "<<a[j]; cout<<" "<<i; cout<<endl; cin>>ans; if(ans==(mid-le+1))ri=mid-1; else le=mid+1; } r[i]=le; } cout<<0; for(i=1;i<=n;i++)cout<<" "<<r[i];cout<<endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:37:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   37 |     for(i=1;i<=n;i++)cout<<" "<<r[i];cout<<endl;
      |     ^~~
carnival.cpp:37:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   37 |     for(i=1;i<=n;i++)cout<<" "<<r[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...