#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 <= 60) {
int pos = rng() % n + 1;
int r = is(pos);
if(r != -1) {
say_answer(r);
return;
}
}
say_answer(-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
364 KB |
Output is correct |
2 |
Correct |
8 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
364 KB |
Output is correct |
2 |
Correct |
27 ms |
364 KB |
Output is correct |
3 |
Correct |
8 ms |
364 KB |
Output is correct |
4 |
Correct |
7 ms |
364 KB |
Output is correct |
5 |
Correct |
23 ms |
364 KB |
Output is correct |
6 |
Correct |
24 ms |
364 KB |
Output is correct |
7 |
Correct |
23 ms |
364 KB |
Output is correct |
8 |
Correct |
33 ms |
364 KB |
Output is correct |
9 |
Correct |
23 ms |
384 KB |
Output is correct |
10 |
Correct |
25 ms |
364 KB |
Output is correct |
11 |
Correct |
25 ms |
364 KB |
Output is correct |
12 |
Correct |
20 ms |
364 KB |
Output is correct |
13 |
Correct |
25 ms |
384 KB |
Output is correct |
14 |
Correct |
21 ms |
364 KB |
Output is correct |