답안 #394269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
394269 2021-04-26T09:54:26 Z KoD Colors (BOI20_colors) C++17
0 / 100
1 ms 200 KB
#include <bits/stdc++.h>

using ll = long long;

bool ask(const ll x) {
    std::cout << "? " << x << std::endl;
    bool f;
    std::cin >> f;
    return f;
}

int main() {
    ll N;
    std::cin >> N;
    ll pos = 1;
    {
        ll x = N - 1;
        int coeff = 0;
        while (x > 1) {
            x = (x + 1) / 2;
            pos += coeff * x;
            coeff = 1 - coeff;
        }
    }
    ll ok = N, ng = 0;
    int dir = 1;
    ask(pos);
    while (ok - ng > 1) {
        const auto md = (ok + ng) / 2;
        pos += dir * md;
        dir = -dir;
        (ask(pos) ? ok : ng) = md;
    }
    std::cout << "= " << ok << std::endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB OK (4 queries)
2 Correct 1 ms 200 KB OK (7 queries)
3 Correct 1 ms 200 KB OK (4 queries)
4 Correct 1 ms 200 KB OK (5 queries)
5 Correct 1 ms 200 KB OK (5 queries)
6 Correct 1 ms 200 KB OK (7 queries)
7 Correct 1 ms 200 KB OK (7 queries)
8 Correct 1 ms 200 KB OK (6 queries)
9 Runtime error 1 ms 200 KB Execution killed with signal 13
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB OK (4 queries)
2 Correct 1 ms 200 KB OK (7 queries)
3 Correct 1 ms 200 KB OK (4 queries)
4 Correct 1 ms 200 KB OK (5 queries)
5 Correct 1 ms 200 KB OK (5 queries)
6 Correct 1 ms 200 KB OK (7 queries)
7 Correct 1 ms 200 KB OK (7 queries)
8 Correct 1 ms 200 KB OK (6 queries)
9 Runtime error 1 ms 200 KB Execution killed with signal 13
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB OK (4 queries)
2 Correct 1 ms 200 KB OK (7 queries)
3 Correct 1 ms 200 KB OK (4 queries)
4 Correct 1 ms 200 KB OK (5 queries)
5 Correct 1 ms 200 KB OK (5 queries)
6 Correct 1 ms 200 KB OK (7 queries)
7 Correct 1 ms 200 KB OK (7 queries)
8 Correct 1 ms 200 KB OK (6 queries)
9 Runtime error 1 ms 200 KB Execution killed with signal 13
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB OK (4 queries)
2 Correct 1 ms 200 KB OK (7 queries)
3 Correct 1 ms 200 KB OK (4 queries)
4 Correct 1 ms 200 KB OK (5 queries)
5 Correct 1 ms 200 KB OK (5 queries)
6 Correct 1 ms 200 KB OK (7 queries)
7 Correct 1 ms 200 KB OK (7 queries)
8 Correct 1 ms 200 KB OK (6 queries)
9 Runtime error 1 ms 200 KB Execution killed with signal 13
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB OK (4 queries)
2 Correct 1 ms 200 KB OK (7 queries)
3 Correct 1 ms 200 KB OK (4 queries)
4 Correct 1 ms 200 KB OK (5 queries)
5 Correct 1 ms 200 KB OK (5 queries)
6 Correct 1 ms 200 KB OK (7 queries)
7 Correct 1 ms 200 KB OK (7 queries)
8 Correct 1 ms 200 KB OK (6 queries)
9 Runtime error 1 ms 200 KB Execution killed with signal 13
10 Halted 0 ms 0 KB -