#include "grader.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(int n) {
set<int> found;
int unknown = n;
vector<int> rem(n);
iota(rem.begin(), rem.end(), 1);
random_shuffle(rem.begin(), rem.end());
while (unknown > n / 3) {
int curr = rem.back();
rem.pop_back();
int v = kth(curr);
if (found.count(v)) continue;
found.insert(v);
int c = cnt(v);
if (c > n / 3) {
say_answer(v);
return;
}
unknown -= c;
}
say_answer(-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
200 KB |
Output is correct |
2 |
Correct |
9 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
16 ms |
200 KB |
Output is partially correct |
2 |
Partially correct |
12 ms |
200 KB |
Output is partially correct |
3 |
Correct |
14 ms |
288 KB |
Output is correct |
4 |
Correct |
11 ms |
200 KB |
Output is correct |
5 |
Correct |
14 ms |
200 KB |
Output is correct |
6 |
Correct |
15 ms |
204 KB |
Output is correct |
7 |
Correct |
7 ms |
296 KB |
Output is correct |
8 |
Correct |
12 ms |
200 KB |
Output is correct |
9 |
Correct |
8 ms |
280 KB |
Output is correct |
10 |
Correct |
10 ms |
200 KB |
Output is correct |
11 |
Correct |
10 ms |
284 KB |
Output is correct |
12 |
Correct |
15 ms |
288 KB |
Output is correct |
13 |
Correct |
9 ms |
284 KB |
Output is correct |
14 |
Correct |
17 ms |
200 KB |
Output is correct |