Submission #1030316

#TimeUsernameProblemLanguageResultExecution timeMemory
1030316sleepntsheepColors (BOI20_colors)C11
0 / 100
0 ms344 KiB
#include<stdio.h> #include<stdlib.h> int a_; int ask(int c){printf("? %d\n",c);fflush(stdout);scanf("%d",&a_);return a_;} [[noreturn]] void report(int C){printf("= %d\n", C);fflush(stdout);exit(0);} int main(){ long long n; scanf("%lld",&n); if(n>1e9)return 1; int lb=0,ub=n+1; ask(1); while(ub-lb>1){ int m=lb+(ub-lb)/2; if(ask(m+1))ub=m; else lb=m; ask(1); } printf("%lld\n",(long long)ub); }

Compilation message (stderr)

Colors.c:5:1: warning: 'noreturn' attribute ignored [-Wattributes]
    5 | [[noreturn]] void report(int C){printf("= %d\n", C);fflush(stdout);exit(0);}
      | ^
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...