Submission #357690

#TimeUsernameProblemLanguageResultExecution timeMemory
357690mjhmjh1104Colors (BOI20_colors)C++17
9 / 100
1 ms384 KiB
#include <cstdio>

int n, t;

int main() {
    scanf("%d", &n);
    int curr = n / 2 + 1;
    printf("? %d\n", curr);
    fflush(stdout);
    scanf("%*d");
    for (int i = 1; i < n; i++) {
        curr += (i % 2 ? -1 : 1) * i;
        printf("? %d\n", curr);
        fflush(stdout);
        scanf("%d", &t);
        if (t) {
            printf("= %d\n", i);
            fflush(stdout);
            return 0;
        }
    }
    printf("= %d\n", n);
    fflush(stdout);
}

Compilation message (stderr)

Colors.cpp: In function 'int main()':
Colors.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    6 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Colors.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     scanf("%*d");
      |     ~~~~~^~~~~~~
Colors.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |         scanf("%d", &t);
      |         ~~~~~^~~~~~~~~~
#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...