Submission #938873

#TimeUsernameProblemLanguageResultExecution timeMemory
938873sleepntsheepCarnival (CEOI14_carnival)C11
100 / 100
16 ms596 KiB
/* CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k */ #include <stdio.h> int n, a[150], m; int ask(int l,int r,int i) { printf("%d ",r-l+1+(!!~i)); for (int i = l; i <= r; ++i) printf("%d ", i+1); if(~i) printf("%d", i+1); puts(""); fflush(stdout); int x; scanf("%d", &x); return x; } int main() { scanf("%d", &n); a[0] = ++m; for (int i = 1; i < n; ++i) { if (ask(0, i-1, -1) != ask(0, i-1, i)) { a[i]=++m; continue; } int l = 0, r = i - 1; while (l < r) { int o = (l+r)/2; if (ask(l, o, -1) == ask(l, o, i)) { r = o; continue; } else { l = o + 1; } } a[i] = a[l]; } printf("0"); for (int i = 0; i < n; ++i) printf(" %d", a[i]);fflush(stdout); }

Compilation message (stderr)

carnival.c: In function 'main':
carnival.c:56:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   56 |     for (int i = 0; i < n; ++i) printf(" %d", a[i]);fflush(stdout);
      |     ^~~
carnival.c:56:53: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   56 |     for (int i = 0; i < n; ++i) printf(" %d", a[i]);fflush(stdout);
      |                                                     ^~~~~~
carnival.c: In function 'ask':
carnival.c:23:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     scanf("%d", &x);
      |     ^~~~~~~~~~~~~~~
carnival.c: In function 'main':
carnival.c:29:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
#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...