#include "grader.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
void solve(int n){
vector<int> inds;
for(int i=1;i<=n;i++)inds.push_back(i);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
shuffle(inds.begin(), inds.end(), rng);
int numq = min(n,30);
for(int i=0;i<numq;i++){
int x = kth(inds[i]);
int c = cnt(x);
if(c > n/3){
say_answer(x);
return;
}
}
say_answer(-1);
return;
}
/*
2
9
4 2 3 4 1 2 5 4
9
4 2 3 4 4 2 5 4
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
364 KB |
Output is correct |
2 |
Correct |
7 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
364 KB |
Output is correct |
2 |
Correct |
33 ms |
364 KB |
Output is correct |
3 |
Correct |
10 ms |
364 KB |
Output is correct |
4 |
Correct |
8 ms |
364 KB |
Output is correct |
5 |
Correct |
24 ms |
364 KB |
Output is correct |
6 |
Correct |
34 ms |
492 KB |
Output is correct |
7 |
Correct |
29 ms |
364 KB |
Output is correct |
8 |
Correct |
34 ms |
492 KB |
Output is correct |
9 |
Correct |
34 ms |
364 KB |
Output is correct |
10 |
Correct |
33 ms |
364 KB |
Output is correct |
11 |
Correct |
29 ms |
364 KB |
Output is correct |
12 |
Correct |
25 ms |
364 KB |
Output is correct |
13 |
Correct |
28 ms |
364 KB |
Output is correct |
14 |
Correct |
28 ms |
364 KB |
Output is correct |