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"
void solve(int n){
std::vector<int>ord(n);
for(int i=0; i<n; i++)
ord[i]=i+1;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
std::shuffle(ord.begin(),ord.end(),rng);
int limit=std::min(n,(n<=50?25:30));
for(int i=0; i<limit; i++){
int v=kth(ord[i]);
int c=cnt(v);
if(c>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... |