Submission #544189

#TimeUsernameProblemLanguageResultExecution timeMemory
544189krit3379Carnival (CEOI14_carnival)C++14
100 / 100
9 ms208 KiB
#include<bits/stdc++.h> using namespace std; #define N 155 int type[N],head[N],ans[N]; int main(){ int n,i,j,l,r,mid,x; scanf("%d",&n); for(i=1;i<=n;i++){ printf("%d ",i); for(j=1;j<=i;j++)printf("%d ",j); printf("\n"); fflush(stdout); scanf("%d",&type[i]); if(type[i]!=type[i-1])head[type[i]]=i; } for(i=1;i<=n;i++){ if(head[type[i]]==i){ ans[i]=type[i]; continue; } l=1,r=type[i]; while(l<r){ mid=(l+r)/2; printf("%d ",mid-l+2); for(j=l;j<=mid;j++)printf("%d ",head[j]); printf("%d \n",i); fflush(stdout); scanf("%d",&x); if(x!=mid-l+1)l=mid+1; else r=mid; } ans[i]=l; } printf("0 "); for(i=1;i<=n;i++)printf("%d ",ans[i]); return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
carnival.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%d",&type[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
carnival.cpp:30:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |             scanf("%d",&x);
      |             ~~~~~^~~~~~~~~
#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...