Submission #1030316

# Submission time Handle Problem Language Result Execution time Memory
1030316 2024-07-22T02:36:50 Z sleepntsheep Colors (BOI20_colors) C
0 / 100
0 ms 344 KB
#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

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 time Memory Grader output
1 Incorrect 0 ms 344 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -