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
#include <bits/stdc++.h>
using namespace std;
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 <= 50) {
int pos = rng() % n + 1;
int r = is(pos);
if(r != -1) {
say_answer(r);
return;
}
}
say_answer(-1);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |