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;
int num[60005];
unordered_map<int, int> mp;
void solve(int n)
{
memset(num, -1, sizeof(num));
mt19937 rng(time(NULL));
int q = 60;
while(q >= 2){
int idx = rng() % n + 1;
if(num[idx] == -1){
q--;
num[idx] = kth(idx);
}
auto u = mp.find(num[idx]);
int cn;
if(u == mp.end()){
cn = cnt(num[idx]);
q--;
}else{
cn = (*u).second;
}
if(cn > n / 3){
say_answer(num[idx]);
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... |