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)
{
bool vis[1010];
memset(vis,0,sizeof vis);
int x=min(n,59);
map<int,int>res;
while(x--){
int id=rand()%n+1;
if(vis[id])continue;
vis[id]=1;
int val=kth(id);
res[val]++;
if(res[val]>n/3){
say_answer(val);
return;
}
}
pair<int,int>mx={-1,0};
for(auto x:res){
if(x.second>mx.first){
mx={x.second,x.first};
}
}
if(cnt(mx.second)>n/3){
say_answer(mx.second);
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... |