Submission #283685

#TimeUsernameProblemLanguageResultExecution timeMemory
2836852qbingxuanThe Big Prize (IOI17_prize)C++14
0 / 100
1 ms360 KiB
#include "prize.h"

#include <bits/stdc++.h>
#ifdef local
#define debug(...) QQBX(#__VA_ARGS__, __VA_ARGS__)
void QQBX(const char *s) {}
template <typename H, typename ...T> void QQBX(const char *s, const H&h, T &&...args) {
    for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr << *s;
    std::cerr << " = " << h << (sizeof...(T) ? ", " : "\n");
    if(sizeof...(T)) QQBX(++s, args...);
}
#define safe std::cerr<<__PRETTY_FUNCTION<<" line "<<__LINE__<<" safe\n";
#else
#define debug(...) ((void)0)
#define safe ((void)0)
#endif // local

using namespace std;

int find_best(int n) {
    /* for(int i = 0; i < n; i++) { */
    /*     vector<int> res = ask(i); */
    /*     if(res[0]+res[1]==0) return i; */
    /* } */
    int x = -1;
    for(int s = 1<<__lg(n); s; s>>=1) if(x+s < n) {
        auto res = ask(x+s);
        if(res[0]+res[1] == 0) return x+s;
        if(res[0] == x+s) x += s;
    }
    return ++x;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...