답안 #1034471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1034471 2024-07-25T14:10:59 Z Blagoj Minerals (JOI19_minerals) C++17
100 / 100
39 ms 4144 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.36));
	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 1 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 9 ms 1112 KB Output is correct
5 Correct 11 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 1 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 9 ms 1112 KB Output is correct
9 Correct 11 ms 1624 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 18 ms 1624 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1668 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 1 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 9 ms 1112 KB Output is correct
9 Correct 11 ms 1624 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 18 ms 1624 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1668 KB Output is correct
15 Correct 27 ms 3664 KB Output is correct
16 Correct 27 ms 3672 KB Output is correct
17 Correct 22 ms 3716 KB Output is correct
18 Correct 20 ms 3920 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 1 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 9 ms 1112 KB Output is correct
9 Correct 11 ms 1624 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 18 ms 1624 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1668 KB Output is correct
15 Correct 27 ms 3664 KB Output is correct
16 Correct 27 ms 3672 KB Output is correct
17 Correct 22 ms 3716 KB Output is correct
18 Correct 20 ms 3920 KB Output is correct
19 Correct 33 ms 3900 KB Output is correct
20 Correct 37 ms 3772 KB Output is correct
21 Correct 33 ms 3864 KB Output is correct
22 Correct 27 ms 3752 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 1 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 9 ms 1112 KB Output is correct
9 Correct 11 ms 1624 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 18 ms 1624 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1668 KB Output is correct
15 Correct 27 ms 3664 KB Output is correct
16 Correct 27 ms 3672 KB Output is correct
17 Correct 22 ms 3716 KB Output is correct
18 Correct 20 ms 3920 KB Output is correct
19 Correct 33 ms 3900 KB Output is correct
20 Correct 37 ms 3772 KB Output is correct
21 Correct 33 ms 3864 KB Output is correct
22 Correct 27 ms 3752 KB Output is correct
23 Correct 34 ms 3664 KB Output is correct
24 Correct 39 ms 3864 KB Output is correct
25 Correct 29 ms 3940 KB Output is correct
26 Correct 26 ms 3672 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 1 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 9 ms 1112 KB Output is correct
9 Correct 11 ms 1624 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 18 ms 1624 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1668 KB Output is correct
15 Correct 27 ms 3664 KB Output is correct
16 Correct 27 ms 3672 KB Output is correct
17 Correct 22 ms 3716 KB Output is correct
18 Correct 20 ms 3920 KB Output is correct
19 Correct 33 ms 3900 KB Output is correct
20 Correct 37 ms 3772 KB Output is correct
21 Correct 33 ms 3864 KB Output is correct
22 Correct 27 ms 3752 KB Output is correct
23 Correct 34 ms 3664 KB Output is correct
24 Correct 39 ms 3864 KB Output is correct
25 Correct 29 ms 3940 KB Output is correct
26 Correct 26 ms 3672 KB Output is correct
27 Correct 36 ms 3772 KB Output is correct
28 Correct 31 ms 3980 KB Output is correct
29 Correct 26 ms 4044 KB Output is correct
30 Correct 22 ms 3828 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 1 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 9 ms 1112 KB Output is correct
9 Correct 11 ms 1624 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 18 ms 1624 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1668 KB Output is correct
15 Correct 27 ms 3664 KB Output is correct
16 Correct 27 ms 3672 KB Output is correct
17 Correct 22 ms 3716 KB Output is correct
18 Correct 20 ms 3920 KB Output is correct
19 Correct 33 ms 3900 KB Output is correct
20 Correct 37 ms 3772 KB Output is correct
21 Correct 33 ms 3864 KB Output is correct
22 Correct 27 ms 3752 KB Output is correct
23 Correct 34 ms 3664 KB Output is correct
24 Correct 39 ms 3864 KB Output is correct
25 Correct 29 ms 3940 KB Output is correct
26 Correct 26 ms 3672 KB Output is correct
27 Correct 36 ms 3772 KB Output is correct
28 Correct 31 ms 3980 KB Output is correct
29 Correct 26 ms 4044 KB Output is correct
30 Correct 22 ms 3828 KB Output is correct
31 Correct 32 ms 3924 KB Output is correct
32 Correct 36 ms 3968 KB Output is correct
33 Correct 24 ms 3960 KB Output is correct
34 Correct 23 ms 4056 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 1 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 9 ms 1112 KB Output is correct
9 Correct 11 ms 1624 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 18 ms 1624 KB Output is correct
13 Correct 8 ms 1624 KB Output is correct
14 Correct 8 ms 1668 KB Output is correct
15 Correct 27 ms 3664 KB Output is correct
16 Correct 27 ms 3672 KB Output is correct
17 Correct 22 ms 3716 KB Output is correct
18 Correct 20 ms 3920 KB Output is correct
19 Correct 33 ms 3900 KB Output is correct
20 Correct 37 ms 3772 KB Output is correct
21 Correct 33 ms 3864 KB Output is correct
22 Correct 27 ms 3752 KB Output is correct
23 Correct 34 ms 3664 KB Output is correct
24 Correct 39 ms 3864 KB Output is correct
25 Correct 29 ms 3940 KB Output is correct
26 Correct 26 ms 3672 KB Output is correct
27 Correct 36 ms 3772 KB Output is correct
28 Correct 31 ms 3980 KB Output is correct
29 Correct 26 ms 4044 KB Output is correct
30 Correct 22 ms 3828 KB Output is correct
31 Correct 32 ms 3924 KB Output is correct
32 Correct 36 ms 3968 KB Output is correct
33 Correct 24 ms 3960 KB Output is correct
34 Correct 23 ms 4056 KB Output is correct
35 Correct 37 ms 4036 KB Output is correct
36 Correct 36 ms 4144 KB Output is correct
37 Correct 22 ms 4040 KB Output is correct
38 Correct 23 ms 4088 KB Output is correct