답안 #331681

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331681 2020-11-29T13:51:23 Z Victor Colors (BOI20_colors) C++17
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

#define ii pair<int, int>
#define iii pair<int, ii>
#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define INF 1000000000

int main()
{
    ll low = 1, high, curr, next, n;
    int response;
    scanf("%lld", &n);
    high = n;
    curr = (n + 3) / 4;
    printf("? %lld\n", curr);
    fflush(NULL);
    scanf("%d", &response);

    while (low != high)
    {
        next = curr + (low + high) / 2;
        if (next > n)
            next = curr - (low + high) / 2;
        printf("? %lld\n", next);
        fflush(NULL);
        scanf("%d", &response);
        if (response)
            high = abs(next - curr);
        else
            low = abs(next - curr) + 1;
        curr = next;
    }
    printf("%lld\n", high);
    return 0;
}

Compilation message

Colors.cpp: In function 'int main()':
Colors.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%lld", &n);
      |     ~~~~~^~~~~~~~~~~~
Colors.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |     scanf("%d", &response);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Colors.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   30 |         scanf("%d", &response);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -