#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int a, int b){
return a+rng()%(b-a+1);
}
void solve(int n) {
pair<int, int> x={0, -1};
vector<int> v;
for (int i=1; i<=n; ++i) v.push_back(i);
shuffle(v.begin(), v.end(), rng);
for (int i=0; i<30; ++i) {
int r=v[i], val=kth(r);
x=max(x, {cnt(val), val});
}
if (x.first > n/3) say_answer(x.second);
else say_answer(-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
56 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
208 KB |
Output is correct |
2 |
Correct |
40 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
208 KB |
Output is correct |
2 |
Correct |
58 ms |
208 KB |
Output is correct |
3 |
Correct |
47 ms |
208 KB |
Output is correct |
4 |
Correct |
43 ms |
208 KB |
Output is correct |
5 |
Correct |
36 ms |
208 KB |
Output is correct |
6 |
Correct |
59 ms |
208 KB |
Output is correct |
7 |
Correct |
79 ms |
208 KB |
Output is correct |
8 |
Correct |
47 ms |
208 KB |
Output is correct |
9 |
Correct |
57 ms |
208 KB |
Output is correct |
10 |
Correct |
77 ms |
208 KB |
Output is correct |
11 |
Correct |
48 ms |
208 KB |
Output is correct |
12 |
Correct |
57 ms |
208 KB |
Output is correct |
13 |
Correct |
50 ms |
208 KB |
Output is correct |
14 |
Correct |
44 ms |
208 KB |
Output is correct |