답안 #973689

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973689 2024-05-02T09:39:38 Z siewjh Minerals (JOI19_minerals) C++17
100 / 100
35 ms 3424 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

int lans = 0;
int qry(int x){ 
	int ans = Query(x);
	swap(lans, ans);
	return lans != ans;
}

void dnc(vector<int> &v1, vector<int> &v2, bool lin){
	int sz = v1.size(), mid = max(1, (int)(sz * 0.4));
	if (sz == 1){
		Answer(v1[0], v2[0]);
		return;
	}
	vector<int> l1, l2, r1, r2;
	for (int i = 0; i < mid; i++){
		qry(v1[i]); l1.push_back(v1[i]);
	}
	for (int i = mid; i < sz; i++) r1.push_back(v1[i]);
	for (int i = 0; i < sz; i++){
		if (l2.size() == l1.size()) r2.push_back(v2[i]);
		else if (r2.size() == r1.size()) l2.push_back(v2[i]);
		else{
			if (lin != qry(v2[i])) l2.push_back(v2[i]);
			else r2.push_back(v2[i]);
		}
	}
	dnc(l1, l2, !lin); dnc(r1, r2, lin);
}

void Solve(int N){
	vector<int> v1, v2;
	for (int i = 1; i <= 2 * N; i++){
		if (qry(i)) v1.push_back(i);
		else v2.push_back(i);
	}
	dnc(v1, v2, 0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 5 ms 752 KB Output is correct
5 Correct 10 ms 1368 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 752 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 856 KB Output is correct
12 Correct 12 ms 1428 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 12 ms 1336 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 752 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 856 KB Output is correct
12 Correct 12 ms 1428 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 12 ms 1336 KB Output is correct
15 Correct 28 ms 2640 KB Output is correct
16 Correct 27 ms 2644 KB Output is correct
17 Correct 20 ms 2620 KB Output is correct
18 Correct 18 ms 2648 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 752 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 856 KB Output is correct
12 Correct 12 ms 1428 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 12 ms 1336 KB Output is correct
15 Correct 28 ms 2640 KB Output is correct
16 Correct 27 ms 2644 KB Output is correct
17 Correct 20 ms 2620 KB Output is correct
18 Correct 18 ms 2648 KB Output is correct
19 Correct 25 ms 2896 KB Output is correct
20 Correct 33 ms 2784 KB Output is correct
21 Correct 23 ms 3424 KB Output is correct
22 Correct 19 ms 2680 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 752 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 856 KB Output is correct
12 Correct 12 ms 1428 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 12 ms 1336 KB Output is correct
15 Correct 28 ms 2640 KB Output is correct
16 Correct 27 ms 2644 KB Output is correct
17 Correct 20 ms 2620 KB Output is correct
18 Correct 18 ms 2648 KB Output is correct
19 Correct 25 ms 2896 KB Output is correct
20 Correct 33 ms 2784 KB Output is correct
21 Correct 23 ms 3424 KB Output is correct
22 Correct 19 ms 2680 KB Output is correct
23 Correct 27 ms 2896 KB Output is correct
24 Correct 31 ms 2792 KB Output is correct
25 Correct 21 ms 2816 KB Output is correct
26 Correct 29 ms 2764 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 752 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 856 KB Output is correct
12 Correct 12 ms 1428 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 12 ms 1336 KB Output is correct
15 Correct 28 ms 2640 KB Output is correct
16 Correct 27 ms 2644 KB Output is correct
17 Correct 20 ms 2620 KB Output is correct
18 Correct 18 ms 2648 KB Output is correct
19 Correct 25 ms 2896 KB Output is correct
20 Correct 33 ms 2784 KB Output is correct
21 Correct 23 ms 3424 KB Output is correct
22 Correct 19 ms 2680 KB Output is correct
23 Correct 27 ms 2896 KB Output is correct
24 Correct 31 ms 2792 KB Output is correct
25 Correct 21 ms 2816 KB Output is correct
26 Correct 29 ms 2764 KB Output is correct
27 Correct 35 ms 3028 KB Output is correct
28 Correct 28 ms 2976 KB Output is correct
29 Correct 19 ms 2792 KB Output is correct
30 Correct 21 ms 2876 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 752 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 856 KB Output is correct
12 Correct 12 ms 1428 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 12 ms 1336 KB Output is correct
15 Correct 28 ms 2640 KB Output is correct
16 Correct 27 ms 2644 KB Output is correct
17 Correct 20 ms 2620 KB Output is correct
18 Correct 18 ms 2648 KB Output is correct
19 Correct 25 ms 2896 KB Output is correct
20 Correct 33 ms 2784 KB Output is correct
21 Correct 23 ms 3424 KB Output is correct
22 Correct 19 ms 2680 KB Output is correct
23 Correct 27 ms 2896 KB Output is correct
24 Correct 31 ms 2792 KB Output is correct
25 Correct 21 ms 2816 KB Output is correct
26 Correct 29 ms 2764 KB Output is correct
27 Correct 35 ms 3028 KB Output is correct
28 Correct 28 ms 2976 KB Output is correct
29 Correct 19 ms 2792 KB Output is correct
30 Correct 21 ms 2876 KB Output is correct
31 Correct 28 ms 2872 KB Output is correct
32 Correct 31 ms 3024 KB Output is correct
33 Correct 20 ms 3020 KB Output is correct
34 Correct 20 ms 2768 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 752 KB Output is correct
9 Correct 10 ms 1368 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 856 KB Output is correct
12 Correct 12 ms 1428 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 12 ms 1336 KB Output is correct
15 Correct 28 ms 2640 KB Output is correct
16 Correct 27 ms 2644 KB Output is correct
17 Correct 20 ms 2620 KB Output is correct
18 Correct 18 ms 2648 KB Output is correct
19 Correct 25 ms 2896 KB Output is correct
20 Correct 33 ms 2784 KB Output is correct
21 Correct 23 ms 3424 KB Output is correct
22 Correct 19 ms 2680 KB Output is correct
23 Correct 27 ms 2896 KB Output is correct
24 Correct 31 ms 2792 KB Output is correct
25 Correct 21 ms 2816 KB Output is correct
26 Correct 29 ms 2764 KB Output is correct
27 Correct 35 ms 3028 KB Output is correct
28 Correct 28 ms 2976 KB Output is correct
29 Correct 19 ms 2792 KB Output is correct
30 Correct 21 ms 2876 KB Output is correct
31 Correct 28 ms 2872 KB Output is correct
32 Correct 31 ms 3024 KB Output is correct
33 Correct 20 ms 3020 KB Output is correct
34 Correct 20 ms 2768 KB Output is correct
35 Correct 30 ms 3064 KB Output is correct
36 Correct 30 ms 3080 KB Output is correct
37 Correct 20 ms 3064 KB Output is correct
38 Correct 23 ms 3180 KB Output is correct