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"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(int n) {
set<int> found;
int unknown = n;
vector<int> rem(n);
iota(rem.begin(), rem.end(), 1);
random_shuffle(rem.begin(), rem.end());
while (unknown > n / 3) {
int curr = rem.back();
rem.pop_back();
int v = kth(curr);
if (found.count(v)) continue;
found.insert(v);
int c = cnt(v);
if (c > n / 3) {
say_answer(v);
return;
}
unknown -= c;
}
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... |