Submission #1030379

#TimeUsernameProblemLanguageResultExecution timeMemory
1030379sleepntsheepColors (BOI20_colors)C11
9 / 100
1 ms512 KiB
#include<stdio.h> #include<stdlib.h> int a_; int ask(int c){printf("? %d\n",c);fflush(stdout);scanf("%d",&a_);return a_;} void report(int C){printf("= %d\n", C);fflush(stdout);exit(0);} int main(){ long long n; scanf("%lld",&n); if(n<=64){ if(n==1)report(1); ask(1); if(!ask(n))report(n); for(int r=n-1,l=2,d=n-1,i=1,cc=0;cc<n-2;++i,--d,++cc) if(i%2&&!ask(l++))report(d); else if(i%2==0&&!ask(r--))report(d); report(1); } if(n<=125){ int m = n / 2 + 1; ask(m); int mid = ask(1); if (!ask(n))report(n); if(mid){ for(int r=m-1,l=2,d=m-1,i=1,cc=0;d>=1;++i,--d,++cc) if(i%2&&!ask(l++))report(d); else if(i%2==0&&!ask(r--))report(d); }else{ for(int r=n-1,l=2,d=n-1,i=1,cc=0;d>=1;++i,--d,++cc) if(i%2&&!ask(l++))report(d); else if(i%2==0&&!ask(r--))report(d); } } }

Compilation message (stderr)

Colors.c: In function 'ask':
Colors.c:4:50: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    4 | int ask(int c){printf("? %d\n",c);fflush(stdout);scanf("%d",&a_);return a_;}
      |                                                  ^~~~~~~~~~~~~~~
Colors.c: In function 'main':
Colors.c:8:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%lld",&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...