Submission #642065

#TimeUsernameProblemLanguageResultExecution timeMemory
642065piOOEThe Big Prize (IOI17_prize)C++17
20 / 100
74 ms336 KiB
#include <bits/stdc++.h>
#include "prize.h"

using namespace std;
using ll = long long;

int find_best(int n) {
    int i = 0;
    int logn = __lg(n) + 2;
    for (; i < n;) {
        auto a = ask(i);
        if (a[0] == 0 && a[1] == 0) {
            return i;
        } else {
            for (int j = logn - 1; j > -1; --j) {
                if (i + (1 << j) < n && ask(i + (1 << j)) == a) {
                    i += 1 << j;
                }
            }
            ++i;
        }
    }
    assert(false);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...