Submission #973684

# Submission time Handle Problem Language Result Execution time Memory
973684 2024-05-02T09:37:23 Z siewjh Minerals (JOI19_minerals) C++17
90 / 100
48 ms 3484 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 = sz >> 1;
	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);
	}
	random_shuffle(v1.begin(), v1.end());
	random_shuffle(v2.begin(), v2.end());
	dnc(v1, v2, 0);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 5 ms 856 KB Output is correct
5 Correct 11 ms 1064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1024 KB Output is correct
12 Correct 11 ms 1340 KB Output is correct
13 Correct 10 ms 1264 KB Output is correct
14 Correct 12 ms 1248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1024 KB Output is correct
12 Correct 11 ms 1340 KB Output is correct
13 Correct 10 ms 1264 KB Output is correct
14 Correct 12 ms 1248 KB Output is correct
15 Correct 33 ms 2488 KB Output is correct
16 Correct 29 ms 2704 KB Output is correct
17 Correct 33 ms 3484 KB Output is correct
18 Correct 35 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1024 KB Output is correct
12 Correct 11 ms 1340 KB Output is correct
13 Correct 10 ms 1264 KB Output is correct
14 Correct 12 ms 1248 KB Output is correct
15 Correct 33 ms 2488 KB Output is correct
16 Correct 29 ms 2704 KB Output is correct
17 Correct 33 ms 3484 KB Output is correct
18 Correct 35 ms 2392 KB Output is correct
19 Correct 35 ms 2768 KB Output is correct
20 Correct 35 ms 2740 KB Output is correct
21 Correct 31 ms 2796 KB Output is correct
22 Correct 39 ms 2596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1024 KB Output is correct
12 Correct 11 ms 1340 KB Output is correct
13 Correct 10 ms 1264 KB Output is correct
14 Correct 12 ms 1248 KB Output is correct
15 Correct 33 ms 2488 KB Output is correct
16 Correct 29 ms 2704 KB Output is correct
17 Correct 33 ms 3484 KB Output is correct
18 Correct 35 ms 2392 KB Output is correct
19 Correct 35 ms 2768 KB Output is correct
20 Correct 35 ms 2740 KB Output is correct
21 Correct 31 ms 2796 KB Output is correct
22 Correct 39 ms 2596 KB Output is correct
23 Correct 33 ms 2816 KB Output is correct
24 Correct 33 ms 2804 KB Output is correct
25 Correct 32 ms 3152 KB Output is correct
26 Correct 32 ms 2868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1024 KB Output is correct
12 Correct 11 ms 1340 KB Output is correct
13 Correct 10 ms 1264 KB Output is correct
14 Correct 12 ms 1248 KB Output is correct
15 Correct 33 ms 2488 KB Output is correct
16 Correct 29 ms 2704 KB Output is correct
17 Correct 33 ms 3484 KB Output is correct
18 Correct 35 ms 2392 KB Output is correct
19 Correct 35 ms 2768 KB Output is correct
20 Correct 35 ms 2740 KB Output is correct
21 Correct 31 ms 2796 KB Output is correct
22 Correct 39 ms 2596 KB Output is correct
23 Correct 33 ms 2816 KB Output is correct
24 Correct 33 ms 2804 KB Output is correct
25 Correct 32 ms 3152 KB Output is correct
26 Correct 32 ms 2868 KB Output is correct
27 Correct 33 ms 2676 KB Output is correct
28 Correct 35 ms 2636 KB Output is correct
29 Correct 33 ms 3100 KB Output is correct
30 Correct 30 ms 3152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1024 KB Output is correct
12 Correct 11 ms 1340 KB Output is correct
13 Correct 10 ms 1264 KB Output is correct
14 Correct 12 ms 1248 KB Output is correct
15 Correct 33 ms 2488 KB Output is correct
16 Correct 29 ms 2704 KB Output is correct
17 Correct 33 ms 3484 KB Output is correct
18 Correct 35 ms 2392 KB Output is correct
19 Correct 35 ms 2768 KB Output is correct
20 Correct 35 ms 2740 KB Output is correct
21 Correct 31 ms 2796 KB Output is correct
22 Correct 39 ms 2596 KB Output is correct
23 Correct 33 ms 2816 KB Output is correct
24 Correct 33 ms 2804 KB Output is correct
25 Correct 32 ms 3152 KB Output is correct
26 Correct 32 ms 2868 KB Output is correct
27 Correct 33 ms 2676 KB Output is correct
28 Correct 35 ms 2636 KB Output is correct
29 Correct 33 ms 3100 KB Output is correct
30 Correct 30 ms 3152 KB Output is correct
31 Correct 35 ms 2916 KB Output is correct
32 Correct 48 ms 2796 KB Output is correct
33 Correct 32 ms 3020 KB Output is correct
34 Correct 30 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 1 ms 344 KB Output is correct
7 Correct 3 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 1024 KB Output is correct
12 Correct 11 ms 1340 KB Output is correct
13 Correct 10 ms 1264 KB Output is correct
14 Correct 12 ms 1248 KB Output is correct
15 Correct 33 ms 2488 KB Output is correct
16 Correct 29 ms 2704 KB Output is correct
17 Correct 33 ms 3484 KB Output is correct
18 Correct 35 ms 2392 KB Output is correct
19 Correct 35 ms 2768 KB Output is correct
20 Correct 35 ms 2740 KB Output is correct
21 Correct 31 ms 2796 KB Output is correct
22 Correct 39 ms 2596 KB Output is correct
23 Correct 33 ms 2816 KB Output is correct
24 Correct 33 ms 2804 KB Output is correct
25 Correct 32 ms 3152 KB Output is correct
26 Correct 32 ms 2868 KB Output is correct
27 Correct 33 ms 2676 KB Output is correct
28 Correct 35 ms 2636 KB Output is correct
29 Correct 33 ms 3100 KB Output is correct
30 Correct 30 ms 3152 KB Output is correct
31 Correct 35 ms 2916 KB Output is correct
32 Correct 48 ms 2796 KB Output is correct
33 Correct 32 ms 3020 KB Output is correct
34 Correct 30 ms 2648 KB Output is correct
35 Incorrect 47 ms 2904 KB Wrong Answer [2]
36 Halted 0 ms 0 KB -