Submission #409571

# Submission time Handle Problem Language Result Execution time Memory
409571 2021-05-21T05:40:37 Z KoD Colors (BOI20_colors) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "proconlib/int_alias"
#include "proconlib/rep"

template <class T>
using Vec = std::vector<T>;

std::pair<u32, bool> first_move(const u32 N) {
    if (N <= 3) return { 1, true };
    const auto h = (N + 1) / 2;
    const auto [p, d] = first_move(h);
    return std::make_pair(d ? p + h : p, !d);
}

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

u32 solve(const u32 N, const u32 pos, const u32 pad) {
    if (N == 2) {
        return ask(pos + pad + 1) ? 1 : 2;
    }
    if (N == 3) {
        if (ask(pos + pad + 2)) {
            return ask(pos - pad - 1) ? 1 : 2;
        }
        return 3;
    }
    const auto h = (N + 1) / 2;
    const auto d = first_move(N).second;
    if (d) {
        if (ask(pos + pad + h)) {
            return solve(h, pos + pad + h, pad);
        }
        else {
            return h + solve(N / 2, pos + pad + h, pad + h);
        }
    }
    else {
        if (ask(pos - pad - h)) {
            return solve(h, pos - pad - h, pad);
        }
        else {
            return h + solve(N / 2, pos - pad - h, pad + h);
        }
    }
}

void main_() {
    u32 N;
    std::cin >> N;
    ask(first_move(N).first);
    const auto ans = solve(N, first_move(N).first, 0);
    std::cout << "= " << ans << std::endl; 
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    main_();
    return 0;
}

Compilation message

Colors.cpp:2:10: fatal error: proconlib/int_alias: No such file or directory
    2 | #include "proconlib/int_alias"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.