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 "bits/stdc++.h"
#include "grader.h"
using namespace std;
/*
const long long MX=2e5+10;
int v[MX];
int k[MX];
int sz;
int kth(int i)
{
return v[i];
}
int cnt(int zn)
{
int rt=0;
for(int i=1;i<=sz;i++)
{
rt+=(v[i]==zn);
}
return rt;
}
void say_answer(int a)
{
cout<<a<<"\n";
exit(0);
}
*/
void solve(int n)
{
for(int i=0;i<25;i++)
{
int zn=kth(((1ll*(rand()%n+1)*(rand()%n+1))%n+1));
int kl=cnt(zn);
if(kl>(n/3))
{
say_answer(zn);
return;
}
}
say_answer(-1);
}
/*
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>sz;
for(int i=1;i<=sz;i++)
{
cin>>v[i];
}
solve(sz);
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |