#include "grader.h"
#include <bits/stdc++.h>
#ifdef local
#define debug(args...) qqbx(#args, args)
template <typename ...T> void qqbx(const char *s, T ...args) {
int cnt = sizeof...(T);
(std::cerr << "(" << s << ") = (" , ... ,
(std::cerr << args << (--cnt ? ", " : ")\n")));
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v), end(v)
using namespace std;
void solve(int n)
{
/// insert your code
/// for example
vector<int> p(n);
iota(all(p), 1);
mt19937 rng(7122);
shuffle(all(p), rng);
for(int i = 0; i < 30 && i < n; i++) {
int x = kth(p[i]);
if(cnt(x) > n / 3) {
say_answer(x);
return;
}
}
say_answer(-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
256 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
384 KB |
Output is correct |
2 |
Correct |
27 ms |
384 KB |
Output is correct |
3 |
Correct |
10 ms |
384 KB |
Output is correct |
4 |
Correct |
11 ms |
256 KB |
Output is correct |
5 |
Correct |
29 ms |
384 KB |
Output is correct |
6 |
Correct |
24 ms |
256 KB |
Output is correct |
7 |
Correct |
32 ms |
308 KB |
Output is correct |
8 |
Correct |
32 ms |
256 KB |
Output is correct |
9 |
Correct |
30 ms |
256 KB |
Output is correct |
10 |
Correct |
33 ms |
256 KB |
Output is correct |
11 |
Correct |
32 ms |
384 KB |
Output is correct |
12 |
Correct |
24 ms |
256 KB |
Output is correct |
13 |
Correct |
29 ms |
360 KB |
Output is correct |
14 |
Correct |
27 ms |
256 KB |
Output is correct |