Submission #25915

#TimeUsernameProblemLanguageResultExecution timeMemory
25915imsifileCarnival (CEOI14_carnival)C++98
100 / 100
13 ms1116 KiB
#include<stdio.h> int N, ba[222], numix[222]; int getrange(int s, int e){ printf("%d ", e-s+1); for(int i=s; i<=e; i++) printf("%d ", i); fflush(stdout); int res; scanf("%d", &res); return res; } int getin(int ix, int s, int e){ printf("%d %d ", e-s+2, ix); for(int i=s; i<=e; i++) printf("%d ", numix[i]); fflush(stdout); int res; scanf("%d", &res); return res; } int main(){ scanf("%d", &N); int pv=0; for(int i=1; i<=N; i++){ int cn = getrange(1,i); if(pv<cn) ba[i]=cn, numix[cn]=i; pv=cn; } for(int i=1; i<=N; i++){ if(ba[i])continue; int mi=1, mx=pv, md; while(1){ md=(mi+mx)/2; if(mi>=mx) break; int cn = getin(i, mi, md); if(cn == md-mi+1) mx=md; else mi=md+1; } ba[i]=md; } printf("0 "); for(int i=1; i<=N; i++) printf("%d ", ba[i]); fflush(stdout); return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int getrange(int, int)':
carnival.cpp:10:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int res; scanf("%d", &res);
                            ^
carnival.cpp: In function 'int getin(int, int, int)':
carnival.cpp:19:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int res; scanf("%d", &res);
                            ^
carnival.cpp: In function 'int main()':
carnival.cpp:24:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  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...