#include "grader.h"
#ifdef CHEISSMART
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
void solve(int n) {
set<int> asked;
int qry = 0;
auto is = [&] (int i) {
int x = kth(i);
qry++;
if(asked.count(x)) return -1;
asked.insert(x);
qry++;
if(cnt(x) * 3 > n) return x;
else return -1;
};
mt19937 rng(time(0));
while(qry + 2 <= 50) {
int pos = rng() % n + 1;
int r = is(pos);
if(r != -1) {
say_answer(r);
return;
}
}
say_answer(-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
364 KB |
Output is correct |
2 |
Correct |
9 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
364 KB |
Output is correct |
2 |
Correct |
25 ms |
364 KB |
Output is correct |
3 |
Correct |
7 ms |
364 KB |
Output is correct |
4 |
Correct |
9 ms |
364 KB |
Output is correct |
5 |
Correct |
18 ms |
364 KB |
Output is correct |
6 |
Correct |
25 ms |
364 KB |
Output is correct |
7 |
Correct |
20 ms |
364 KB |
Output is correct |
8 |
Correct |
27 ms |
364 KB |
Output is correct |
9 |
Correct |
24 ms |
364 KB |
Output is correct |
10 |
Correct |
29 ms |
364 KB |
Output is correct |
11 |
Correct |
24 ms |
364 KB |
Output is correct |
12 |
Correct |
24 ms |
364 KB |
Output is correct |
13 |
Correct |
22 ms |
364 KB |
Output is correct |
14 |
Correct |
20 ms |
364 KB |
Output is correct |