#include "grader.h"
#include <random>
#include <iostream>
using namespace std;
void solve(int n)
{
int mb = (n > 50 ? 30 : 25);
mt19937 rng(n^mb);
uniform_int_distribution<int> uni(0, 1e9);
for (int i = 0; i < mb; i++)
{
int ind = uni(rng) % n;
int cand = kth(ind + 1);
int app = cnt(cand);
if (app > n / 3)
{
say_answer(cand);
return;
}
}
say_answer(-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
364 KB |
Output is correct |
2 |
Correct |
8 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
384 KB |
Output is correct |
2 |
Correct |
24 ms |
364 KB |
Output is correct |
3 |
Correct |
8 ms |
364 KB |
Output is correct |
4 |
Correct |
9 ms |
364 KB |
Output is correct |
5 |
Correct |
20 ms |
364 KB |
Output is correct |
6 |
Correct |
26 ms |
384 KB |
Output is correct |
7 |
Correct |
21 ms |
364 KB |
Output is correct |
8 |
Correct |
28 ms |
364 KB |
Output is correct |
9 |
Correct |
26 ms |
364 KB |
Output is correct |
10 |
Correct |
14 ms |
364 KB |
Output is correct |
11 |
Correct |
25 ms |
364 KB |
Output is correct |
12 |
Correct |
21 ms |
364 KB |
Output is correct |
13 |
Correct |
29 ms |
364 KB |
Output is correct |
14 |
Correct |
26 ms |
364 KB |
Output is correct |