Submission #357668

#TimeUsernameProblemLanguageResultExecution timeMemory
357668urd05Colors (BOI20_colors)C++14
9 / 100
2 ms364 KiB
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    long long n;
    scanf("%lld",&n);
    long long l=2;
    long long r=n;
    long long now=1;
    printf("? %lld\n",now);
    fflush(stdout);
    int got;
    scanf("%d",&got);
    long long ret=1;
    for(int i=n-1;i>0;i--) {
        if (now==l-1) {
            now=r;
            r--;
        }
        else {
            now=l;
            l++;
        }
        printf("? %lld\n",now);
        fflush(stdout);
        scanf("%d",&got);
        if (got==0) {
            ret=i+1;
            break;
        }
    }
    printf("= %lld\n",ret);
    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("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
Colors.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |     scanf("%d",&got);
      |     ~~~~~^~~~~~~~~~~
Colors.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |         scanf("%d",&got);
      |         ~~~~~^~~~~~~~~~~
#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...