#include <bits/stdc++.h>
#include<grader.h>
using namespace std;
void solve(int n)
{
int k = 30;
if(n<=50)
k = 25;
int best = 0;
int ans = -1;
mt19937 mt_rand(time(0));
for(int i = 0;i<k;i++)
{
int s = uniform_int_distribution<int>(1, n)(mt_rand);
int w = kth(s);
int c = cnt(w);
if(c>best)
{
best = c;
ans = w;
}
}
if(best>n/3)
say_answer(ans);
else
say_answer(-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
364 KB |
Output is correct |
2 |
Correct |
57 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
364 KB |
Output is correct |
2 |
Correct |
31 ms |
364 KB |
Output is correct |
3 |
Correct |
63 ms |
364 KB |
Output is correct |
4 |
Correct |
48 ms |
364 KB |
Output is correct |
5 |
Correct |
55 ms |
364 KB |
Output is correct |
6 |
Correct |
66 ms |
384 KB |
Output is correct |
7 |
Correct |
58 ms |
364 KB |
Output is correct |
8 |
Correct |
74 ms |
364 KB |
Output is correct |
9 |
Correct |
67 ms |
364 KB |
Output is correct |
10 |
Correct |
59 ms |
384 KB |
Output is correct |
11 |
Correct |
53 ms |
364 KB |
Output is correct |
12 |
Correct |
53 ms |
364 KB |
Output is correct |
13 |
Correct |
86 ms |
364 KB |
Output is correct |
14 |
Correct |
70 ms |
364 KB |
Output is correct |