Submission #357666

# Submission time Handle Problem Language Result Execution time Memory
357666 2021-01-24T11:38:15 Z urd05 Colors (BOI20_colors) C++14
0 / 100
1 ms 364 KB
#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;
        }
    }
    return ret;
}

Compilation message

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 time Memory Grader output
1 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -