# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341976 | cheissmart | CONSUL (info1cup19_consul) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#ifdef CHEISSMART
#include "grader.cpp"
#endif
void solve(int n) {
set<int> asked;
int qry = 0;
auto is = [&] (int i) {
int x = kth(i);
qry++;
if(asked.count(x)) return -1;
asked.insert(x);
qry++;
if(cnt(x) * 3 > n) return x;
else return -1;
};
mt19937 rng(time(0));
while(qry + 2 <= 60) {
int pos = rng() % n + 1;
int r = is(pos);
if(r != -1) say_answer(r);
}
say_answer(-1);
}