답안 #1034457

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1034457 2024-07-25T14:00:01 Z Blagoj Minerals (JOI19_minerals) C++17
90 / 100
33 ms 3744 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 = sz / 2;
	for (int i = 0; i < mid; i++) {
		get(l[i]);
		l1.push_back(l[i]);
	}
	for (int i = mid; 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 1 ms 344 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 6 ms 856 KB Output is correct
5 Correct 9 ms 1368 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 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 9 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 7 ms 1452 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 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 9 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 7 ms 1452 KB Output is correct
15 Correct 26 ms 3480 KB Output is correct
16 Correct 23 ms 3156 KB Output is correct
17 Correct 19 ms 3004 KB Output is correct
18 Correct 17 ms 2852 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 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 9 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 7 ms 1452 KB Output is correct
15 Correct 26 ms 3480 KB Output is correct
16 Correct 23 ms 3156 KB Output is correct
17 Correct 19 ms 3004 KB Output is correct
18 Correct 17 ms 2852 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 27 ms 3416 KB Output is correct
21 Correct 22 ms 3284 KB Output is correct
22 Correct 19 ms 3160 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 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 9 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 7 ms 1452 KB Output is correct
15 Correct 26 ms 3480 KB Output is correct
16 Correct 23 ms 3156 KB Output is correct
17 Correct 19 ms 3004 KB Output is correct
18 Correct 17 ms 2852 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 27 ms 3416 KB Output is correct
21 Correct 22 ms 3284 KB Output is correct
22 Correct 19 ms 3160 KB Output is correct
23 Correct 26 ms 3312 KB Output is correct
24 Correct 27 ms 3416 KB Output is correct
25 Correct 19 ms 3284 KB Output is correct
26 Correct 24 ms 3152 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 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 9 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 7 ms 1452 KB Output is correct
15 Correct 26 ms 3480 KB Output is correct
16 Correct 23 ms 3156 KB Output is correct
17 Correct 19 ms 3004 KB Output is correct
18 Correct 17 ms 2852 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 27 ms 3416 KB Output is correct
21 Correct 22 ms 3284 KB Output is correct
22 Correct 19 ms 3160 KB Output is correct
23 Correct 26 ms 3312 KB Output is correct
24 Correct 27 ms 3416 KB Output is correct
25 Correct 19 ms 3284 KB Output is correct
26 Correct 24 ms 3152 KB Output is correct
27 Correct 31 ms 3416 KB Output is correct
28 Correct 32 ms 3416 KB Output is correct
29 Correct 19 ms 3420 KB Output is correct
30 Correct 21 ms 3292 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 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 9 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 7 ms 1452 KB Output is correct
15 Correct 26 ms 3480 KB Output is correct
16 Correct 23 ms 3156 KB Output is correct
17 Correct 19 ms 3004 KB Output is correct
18 Correct 17 ms 2852 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 27 ms 3416 KB Output is correct
21 Correct 22 ms 3284 KB Output is correct
22 Correct 19 ms 3160 KB Output is correct
23 Correct 26 ms 3312 KB Output is correct
24 Correct 27 ms 3416 KB Output is correct
25 Correct 19 ms 3284 KB Output is correct
26 Correct 24 ms 3152 KB Output is correct
27 Correct 31 ms 3416 KB Output is correct
28 Correct 32 ms 3416 KB Output is correct
29 Correct 19 ms 3420 KB Output is correct
30 Correct 21 ms 3292 KB Output is correct
31 Correct 30 ms 3552 KB Output is correct
32 Correct 28 ms 3416 KB Output is correct
33 Correct 22 ms 3532 KB Output is correct
34 Correct 28 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 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 9 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 10 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 7 ms 1452 KB Output is correct
15 Correct 26 ms 3480 KB Output is correct
16 Correct 23 ms 3156 KB Output is correct
17 Correct 19 ms 3004 KB Output is correct
18 Correct 17 ms 2852 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 27 ms 3416 KB Output is correct
21 Correct 22 ms 3284 KB Output is correct
22 Correct 19 ms 3160 KB Output is correct
23 Correct 26 ms 3312 KB Output is correct
24 Correct 27 ms 3416 KB Output is correct
25 Correct 19 ms 3284 KB Output is correct
26 Correct 24 ms 3152 KB Output is correct
27 Correct 31 ms 3416 KB Output is correct
28 Correct 32 ms 3416 KB Output is correct
29 Correct 19 ms 3420 KB Output is correct
30 Correct 21 ms 3292 KB Output is correct
31 Correct 30 ms 3552 KB Output is correct
32 Correct 28 ms 3416 KB Output is correct
33 Correct 22 ms 3532 KB Output is correct
34 Correct 28 ms 3408 KB Output is correct
35 Incorrect 33 ms 3744 KB Wrong Answer [2]
36 Halted 0 ms 0 KB -