#include "grader.h"
#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))
using namespace std;
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
#ifdef wiwihorz
#define print(a...) cerr << "Line: " << __LINE__, kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif
random;
void solve(int n)
{
set<int> s;
rep(i, 1, 25) {
int k;
while(k = rnd() % n + 1, s.find(k) != s.end());
s.insert(k);
k = kth(k);
if(cnt(k) > n / 3) {
say_answer(k);
return;
}
}
say_answer(-1);
}
Compilation message
consul.cpp:5: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
5 | #pragma loop-opt(on)
|
consul.cpp:20:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
20 | void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
| ^~~~
consul.cpp:20:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
20 | void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
200 KB |
Output is correct |
2 |
Correct |
11 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
200 KB |
Output is correct |
2 |
Correct |
21 ms |
200 KB |
Output is correct |
3 |
Correct |
7 ms |
200 KB |
Output is correct |
4 |
Correct |
10 ms |
200 KB |
Output is correct |
5 |
Correct |
24 ms |
200 KB |
Output is correct |
6 |
Correct |
31 ms |
200 KB |
Output is correct |
7 |
Correct |
35 ms |
200 KB |
Output is correct |
8 |
Correct |
30 ms |
200 KB |
Output is correct |
9 |
Correct |
30 ms |
200 KB |
Output is correct |
10 |
Correct |
29 ms |
200 KB |
Output is correct |
11 |
Correct |
32 ms |
200 KB |
Output is correct |
12 |
Correct |
23 ms |
200 KB |
Output is correct |
13 |
Correct |
31 ms |
200 KB |
Output is correct |
14 |
Correct |
18 ms |
200 KB |
Output is correct |