답안 #1034460

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1034460 2024-07-25T14:01:25 Z Blagoj Minerals (JOI19_minerals) C++17
100 / 100
32 ms 3928 KB
#include <bits/stdc++.h>
#include "minerals.h"

using namespace std;

int val;

bool get(int x) {
	int otherVal = Query(x);
	swap(val, otherVal);
	return val != otherVal;
}

void solve(vector<int> l, vector<int> r, int t) {
	int sz = l.size();
	if (sz == 1) {
		Answer(l[0], r[0]);
		return;
	}
	vector<int> l1, l2, r1, r2;
	int mid = (int) (sz * (0.4));
	for (int i = 0; i <= mid; i++) {
		get(l[i]);
		l1.push_back(l[i]);
	}
	for (int i = mid + 1; i < sz; i++) r1.push_back(l[i]);
	for (int i = 0; i < sz; i++) {
		if (l1.size() == l2.size()) r2.push_back(r[i]);
		else if (r1.size() == r2.size()) l2.push_back(r[i]);
		else if (get(r[i]) == t) l2.push_back(r[i]);
		else r2.push_back(r[i]);
	}
	solve(l1, l2, !t);
	solve(r1, r2, t);
}

void Solve(int N) {
    vector<int> l, r;
    for (int i = 1; i <= 2 * N; i++) {
		if (get(i)) l.push_back(i);
		else r.push_back(i);
    }
	solve(l, r, 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 6 ms 1112 KB Output is correct
5 Correct 10 ms 1700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1700 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1692 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1700 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1692 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1624 KB Output is correct
15 Correct 27 ms 3644 KB Output is correct
16 Correct 32 ms 3540 KB Output is correct
17 Correct 23 ms 3460 KB Output is correct
18 Correct 20 ms 3416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1700 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1692 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1624 KB Output is correct
15 Correct 27 ms 3644 KB Output is correct
16 Correct 32 ms 3540 KB Output is correct
17 Correct 23 ms 3460 KB Output is correct
18 Correct 20 ms 3416 KB Output is correct
19 Correct 28 ms 3664 KB Output is correct
20 Correct 32 ms 3664 KB Output is correct
21 Correct 20 ms 3660 KB Output is correct
22 Correct 23 ms 3408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1700 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1692 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1624 KB Output is correct
15 Correct 27 ms 3644 KB Output is correct
16 Correct 32 ms 3540 KB Output is correct
17 Correct 23 ms 3460 KB Output is correct
18 Correct 20 ms 3416 KB Output is correct
19 Correct 28 ms 3664 KB Output is correct
20 Correct 32 ms 3664 KB Output is correct
21 Correct 20 ms 3660 KB Output is correct
22 Correct 23 ms 3408 KB Output is correct
23 Correct 28 ms 3616 KB Output is correct
24 Correct 29 ms 3672 KB Output is correct
25 Correct 20 ms 3796 KB Output is correct
26 Correct 27 ms 3640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1700 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1692 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1624 KB Output is correct
15 Correct 27 ms 3644 KB Output is correct
16 Correct 32 ms 3540 KB Output is correct
17 Correct 23 ms 3460 KB Output is correct
18 Correct 20 ms 3416 KB Output is correct
19 Correct 28 ms 3664 KB Output is correct
20 Correct 32 ms 3664 KB Output is correct
21 Correct 20 ms 3660 KB Output is correct
22 Correct 23 ms 3408 KB Output is correct
23 Correct 28 ms 3616 KB Output is correct
24 Correct 29 ms 3672 KB Output is correct
25 Correct 20 ms 3796 KB Output is correct
26 Correct 27 ms 3640 KB Output is correct
27 Correct 29 ms 3672 KB Output is correct
28 Correct 31 ms 3828 KB Output is correct
29 Correct 21 ms 3680 KB Output is correct
30 Correct 22 ms 3512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1700 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1692 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1624 KB Output is correct
15 Correct 27 ms 3644 KB Output is correct
16 Correct 32 ms 3540 KB Output is correct
17 Correct 23 ms 3460 KB Output is correct
18 Correct 20 ms 3416 KB Output is correct
19 Correct 28 ms 3664 KB Output is correct
20 Correct 32 ms 3664 KB Output is correct
21 Correct 20 ms 3660 KB Output is correct
22 Correct 23 ms 3408 KB Output is correct
23 Correct 28 ms 3616 KB Output is correct
24 Correct 29 ms 3672 KB Output is correct
25 Correct 20 ms 3796 KB Output is correct
26 Correct 27 ms 3640 KB Output is correct
27 Correct 29 ms 3672 KB Output is correct
28 Correct 31 ms 3828 KB Output is correct
29 Correct 21 ms 3680 KB Output is correct
30 Correct 22 ms 3512 KB Output is correct
31 Correct 30 ms 3836 KB Output is correct
32 Correct 30 ms 3912 KB Output is correct
33 Correct 21 ms 3696 KB Output is correct
34 Correct 23 ms 3580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 10 ms 1700 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1112 KB Output is correct
12 Correct 10 ms 1692 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1624 KB Output is correct
15 Correct 27 ms 3644 KB Output is correct
16 Correct 32 ms 3540 KB Output is correct
17 Correct 23 ms 3460 KB Output is correct
18 Correct 20 ms 3416 KB Output is correct
19 Correct 28 ms 3664 KB Output is correct
20 Correct 32 ms 3664 KB Output is correct
21 Correct 20 ms 3660 KB Output is correct
22 Correct 23 ms 3408 KB Output is correct
23 Correct 28 ms 3616 KB Output is correct
24 Correct 29 ms 3672 KB Output is correct
25 Correct 20 ms 3796 KB Output is correct
26 Correct 27 ms 3640 KB Output is correct
27 Correct 29 ms 3672 KB Output is correct
28 Correct 31 ms 3828 KB Output is correct
29 Correct 21 ms 3680 KB Output is correct
30 Correct 22 ms 3512 KB Output is correct
31 Correct 30 ms 3836 KB Output is correct
32 Correct 30 ms 3912 KB Output is correct
33 Correct 21 ms 3696 KB Output is correct
34 Correct 23 ms 3580 KB Output is correct
35 Correct 31 ms 3920 KB Output is correct
36 Correct 31 ms 3928 KB Output is correct
37 Correct 22 ms 3788 KB Output is correct
38 Correct 22 ms 3672 KB Output is correct