#include "grader.h"
#include "bits/stdc++.h"
void solve(int n){
std::vector<int>ord(n);
for(int i=0; i<n; i++)
ord[i]=i+1;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
std::shuffle(ord.begin(),ord.end(),rng);
for(int i=0; i<std::min(n,30); i++){
int v=kth(ord[i]);
int c=cnt(v);
if(c>n/3) {
say_answer(v);
return;
}
}
say_answer(-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
208 KB |
Output is correct |
2 |
Correct |
9 ms |
292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
208 KB |
Output is correct |
2 |
Correct |
20 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
288 KB |
Output is correct |
4 |
Correct |
10 ms |
292 KB |
Output is correct |
5 |
Correct |
22 ms |
296 KB |
Output is correct |
6 |
Correct |
21 ms |
208 KB |
Output is correct |
7 |
Correct |
22 ms |
284 KB |
Output is correct |
8 |
Correct |
26 ms |
288 KB |
Output is correct |
9 |
Correct |
23 ms |
208 KB |
Output is correct |
10 |
Correct |
26 ms |
336 KB |
Output is correct |
11 |
Correct |
26 ms |
208 KB |
Output is correct |
12 |
Correct |
24 ms |
208 KB |
Output is correct |
13 |
Correct |
22 ms |
208 KB |
Output is correct |
14 |
Correct |
21 ms |
276 KB |
Output is correct |