#include "minerals.h"
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
string _reset = "\u001b[0m", _yellow = "\u001b[33m", _bold = "\u001b[1m";
void DBG() { cerr << "]" << _reset << endl; }
template<class H, class...T> void DBG(H h, T ...t) {
cerr << to_string(h);
if(sizeof ...(t)) cerr << ", ";
DBG(t...);
}
#ifdef CHEISSMART
#define debug(...) cerr << _yellow << _bold << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define debug(...)
#endif
const int INF = 1e9 + 7;
int now;
bool isin(int i) {
int pre = now;
now = Query(i);
return pre == now;
}
void solve(vi a, vi b, int n, bool in) {
assert(int(a.size()) == n);
assert(int(b.size()) == n);
if(n == 1) {
Answer(a[0], b[0]);
return;
}
int m = max(1, int(0.382 * n));
vi al, bl, ar, br;
for(int i = 0; i < m; i++) {
now = Query(a[i]);
al.PB(a[i]);
}
for(int i = m; i < n; i++)
ar.PB(a[i]);
for(int i:b) {
if(isin(i)) {
if(in) br.PB(i);
else bl.PB(i);
} else {
if(in) bl.PB(i);
else br.PB(i);
}
}
solve(al, bl, m, !in);
solve(ar, br, n - m, in);
}
void Solve(int n) {
int pre = 0;
vi a, b;
for(int i = 1; i <= 2 * n; i++) {
now = Query(i);
if(pre == now)
a.PB(i);
else
b.PB(i);
pre = now;
}
solve(a, b, n, true);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
2 ms |
456 KB |
Output is correct |
3 |
Correct |
4 ms |
584 KB |
Output is correct |
4 |
Correct |
8 ms |
868 KB |
Output is correct |
5 |
Correct |
14 ms |
1532 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
868 KB |
Output is correct |
9 |
Correct |
14 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
1096 KB |
Output is correct |
12 |
Correct |
15 ms |
1580 KB |
Output is correct |
13 |
Correct |
13 ms |
1524 KB |
Output is correct |
14 |
Correct |
15 ms |
1500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
868 KB |
Output is correct |
9 |
Correct |
14 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
1096 KB |
Output is correct |
12 |
Correct |
15 ms |
1580 KB |
Output is correct |
13 |
Correct |
13 ms |
1524 KB |
Output is correct |
14 |
Correct |
15 ms |
1500 KB |
Output is correct |
15 |
Correct |
39 ms |
3532 KB |
Output is correct |
16 |
Correct |
45 ms |
3520 KB |
Output is correct |
17 |
Correct |
32 ms |
3584 KB |
Output is correct |
18 |
Correct |
40 ms |
3392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
868 KB |
Output is correct |
9 |
Correct |
14 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
1096 KB |
Output is correct |
12 |
Correct |
15 ms |
1580 KB |
Output is correct |
13 |
Correct |
13 ms |
1524 KB |
Output is correct |
14 |
Correct |
15 ms |
1500 KB |
Output is correct |
15 |
Correct |
39 ms |
3532 KB |
Output is correct |
16 |
Correct |
45 ms |
3520 KB |
Output is correct |
17 |
Correct |
32 ms |
3584 KB |
Output is correct |
18 |
Correct |
40 ms |
3392 KB |
Output is correct |
19 |
Correct |
41 ms |
3628 KB |
Output is correct |
20 |
Correct |
41 ms |
3648 KB |
Output is correct |
21 |
Correct |
35 ms |
3608 KB |
Output is correct |
22 |
Correct |
34 ms |
3428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
868 KB |
Output is correct |
9 |
Correct |
14 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
1096 KB |
Output is correct |
12 |
Correct |
15 ms |
1580 KB |
Output is correct |
13 |
Correct |
13 ms |
1524 KB |
Output is correct |
14 |
Correct |
15 ms |
1500 KB |
Output is correct |
15 |
Correct |
39 ms |
3532 KB |
Output is correct |
16 |
Correct |
45 ms |
3520 KB |
Output is correct |
17 |
Correct |
32 ms |
3584 KB |
Output is correct |
18 |
Correct |
40 ms |
3392 KB |
Output is correct |
19 |
Correct |
41 ms |
3628 KB |
Output is correct |
20 |
Correct |
41 ms |
3648 KB |
Output is correct |
21 |
Correct |
35 ms |
3608 KB |
Output is correct |
22 |
Correct |
34 ms |
3428 KB |
Output is correct |
23 |
Correct |
43 ms |
3652 KB |
Output is correct |
24 |
Correct |
44 ms |
3652 KB |
Output is correct |
25 |
Correct |
35 ms |
3636 KB |
Output is correct |
26 |
Correct |
41 ms |
3468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
868 KB |
Output is correct |
9 |
Correct |
14 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
1096 KB |
Output is correct |
12 |
Correct |
15 ms |
1580 KB |
Output is correct |
13 |
Correct |
13 ms |
1524 KB |
Output is correct |
14 |
Correct |
15 ms |
1500 KB |
Output is correct |
15 |
Correct |
39 ms |
3532 KB |
Output is correct |
16 |
Correct |
45 ms |
3520 KB |
Output is correct |
17 |
Correct |
32 ms |
3584 KB |
Output is correct |
18 |
Correct |
40 ms |
3392 KB |
Output is correct |
19 |
Correct |
41 ms |
3628 KB |
Output is correct |
20 |
Correct |
41 ms |
3648 KB |
Output is correct |
21 |
Correct |
35 ms |
3608 KB |
Output is correct |
22 |
Correct |
34 ms |
3428 KB |
Output is correct |
23 |
Correct |
43 ms |
3652 KB |
Output is correct |
24 |
Correct |
44 ms |
3652 KB |
Output is correct |
25 |
Correct |
35 ms |
3636 KB |
Output is correct |
26 |
Correct |
41 ms |
3468 KB |
Output is correct |
27 |
Correct |
43 ms |
3664 KB |
Output is correct |
28 |
Correct |
42 ms |
3708 KB |
Output is correct |
29 |
Correct |
37 ms |
3772 KB |
Output is correct |
30 |
Correct |
42 ms |
3532 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
868 KB |
Output is correct |
9 |
Correct |
14 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
1096 KB |
Output is correct |
12 |
Correct |
15 ms |
1580 KB |
Output is correct |
13 |
Correct |
13 ms |
1524 KB |
Output is correct |
14 |
Correct |
15 ms |
1500 KB |
Output is correct |
15 |
Correct |
39 ms |
3532 KB |
Output is correct |
16 |
Correct |
45 ms |
3520 KB |
Output is correct |
17 |
Correct |
32 ms |
3584 KB |
Output is correct |
18 |
Correct |
40 ms |
3392 KB |
Output is correct |
19 |
Correct |
41 ms |
3628 KB |
Output is correct |
20 |
Correct |
41 ms |
3648 KB |
Output is correct |
21 |
Correct |
35 ms |
3608 KB |
Output is correct |
22 |
Correct |
34 ms |
3428 KB |
Output is correct |
23 |
Correct |
43 ms |
3652 KB |
Output is correct |
24 |
Correct |
44 ms |
3652 KB |
Output is correct |
25 |
Correct |
35 ms |
3636 KB |
Output is correct |
26 |
Correct |
41 ms |
3468 KB |
Output is correct |
27 |
Correct |
43 ms |
3664 KB |
Output is correct |
28 |
Correct |
42 ms |
3708 KB |
Output is correct |
29 |
Correct |
37 ms |
3772 KB |
Output is correct |
30 |
Correct |
42 ms |
3532 KB |
Output is correct |
31 |
Incorrect |
45 ms |
3788 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
868 KB |
Output is correct |
9 |
Correct |
14 ms |
1532 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
1096 KB |
Output is correct |
12 |
Correct |
15 ms |
1580 KB |
Output is correct |
13 |
Correct |
13 ms |
1524 KB |
Output is correct |
14 |
Correct |
15 ms |
1500 KB |
Output is correct |
15 |
Correct |
39 ms |
3532 KB |
Output is correct |
16 |
Correct |
45 ms |
3520 KB |
Output is correct |
17 |
Correct |
32 ms |
3584 KB |
Output is correct |
18 |
Correct |
40 ms |
3392 KB |
Output is correct |
19 |
Correct |
41 ms |
3628 KB |
Output is correct |
20 |
Correct |
41 ms |
3648 KB |
Output is correct |
21 |
Correct |
35 ms |
3608 KB |
Output is correct |
22 |
Correct |
34 ms |
3428 KB |
Output is correct |
23 |
Correct |
43 ms |
3652 KB |
Output is correct |
24 |
Correct |
44 ms |
3652 KB |
Output is correct |
25 |
Correct |
35 ms |
3636 KB |
Output is correct |
26 |
Correct |
41 ms |
3468 KB |
Output is correct |
27 |
Correct |
43 ms |
3664 KB |
Output is correct |
28 |
Correct |
42 ms |
3708 KB |
Output is correct |
29 |
Correct |
37 ms |
3772 KB |
Output is correct |
30 |
Correct |
42 ms |
3532 KB |
Output is correct |
31 |
Incorrect |
45 ms |
3788 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |