Submission #25969

#TimeUsernameProblemLanguageResultExecution timeMemory
25969tlwpdusCarnival (CEOI14_carnival)C++98
100 / 100
9 ms2020 KiB
#include <bits/stdc++.h> using namespace std; int n; int color[160]; int rep[160]; int key = 0; void bs(int idx) { int s = 1, e = key, i; while(s<e) { int m = (s+e)>>1; printf("%d ",m-s+2); for (i=s;i<=m;i++) printf("%d ",rep[i]); printf("%d\n",idx); fflush(stdout); int a; scanf("%d",&a); if (a==m-s+1) e = m; else s = m+1; } color[idx] = s; } int main() { int i, j; 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); int val; scanf("%d",&val); if (key<val) { key=val; color[i] = key; rep[key] = i; } } for (i=1;i<=n;i++) { if (color[i]) continue; bs(i); } printf("0 "); for (i=1;i<=n;i++) printf("%d ",color[i]); printf("\n"); return 0; }

Compilation message (stderr)

carnival.cpp: In function 'void bs(int)':
carnival.cpp:20:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a);
                       ^
carnival.cpp: In function 'int main()':
carnival.cpp:29:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
carnival.cpp:36:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&val);
                         ^
#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...