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>
using namespace std;
void solve(int N) {
srand(time(NULL));
int V[N];
for (int i = 0; i < N; i++) {
V[i] = rand();
}
int ord[N];
iota(ord, ord+N, 0);
sort(ord, ord+N, [&](const int &a, const int &b) {
return V[a] < V[b];
});
map<int, int> m;
for (int x = 0, i = 0; x < min(N, 60) && i < N; x++, i++) {
int v = kth(ord[i]+1);
if (m.find(v) == m.end() && x < min(N, 60)-1) {
m[v] = cnt(v);
x++;
}
if (m[v] > N/3) {
say_answer(v);
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... |