#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;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
7 ms |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
344 KB |
Output is correct |
5 |
Correct |
7 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
344 KB |
Output is correct |
7 |
Correct |
8 ms |
344 KB |
Output is correct |
8 |
Correct |
10 ms |
344 KB |
Output is correct |
9 |
Correct |
9 ms |
344 KB |
Output is correct |
10 |
Correct |
8 ms |
344 KB |
Output is correct |
11 |
Correct |
9 ms |
352 KB |
Output is correct |
12 |
Correct |
7 ms |
344 KB |
Output is correct |
13 |
Correct |
9 ms |
344 KB |
Output is correct |
14 |
Correct |
7 ms |
344 KB |
Output is correct |