Submission #615469

# Submission time Handle Problem Language Result Execution time Memory
615469 2022-07-31T09:38:21 Z valerikk Minerals (JOI19_minerals) C++17
80 / 100
47 ms 3364 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
 
mt19937 gen(239);

int last;

bool query(int x) {
	int cur = Query(x);
	bool res = cur != last;
	last = cur;
	return res;
}

void solve(vector<int> a, vector<int> b, bool f) {
	int n = a.size();
	if (n == 1) {
		Answer(a[0], b[0]);
		return;
	}
	int m = n / 2;
	vector<int> a1, a2, b1, b2;
	for (int i = 0; i < m; ++i) {
		query(a[i]);
		a1.push_back(a[i]);
	}
	for (int i = m; i < n; ++i) {
		a2.push_back(a[i]);
	}
	for (int i = 0; i < n; ++i) {
		if (query(b[i]) ^ f) {
			b2.push_back(b[i]);
		} else {
			b1.push_back(b[i]);
		}
	}
	solve(a1, b1, !f);
	solve(a2, b2, f);
}
 
void Solve(int N) {
	vector<int> a, b;
	last = 0;
	for (int i = 1; i <= 2 * N; ++i) {
		if (query(i)) {
			a.push_back(i);
		} else {
			b.push_back(i);
		}
	}
	solve(a, b, true);
}	
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 4 ms 464 KB Output is correct
4 Correct 7 ms 752 KB Output is correct
5 Correct 15 ms 1336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 7 ms 752 KB Output is correct
9 Correct 15 ms 1336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1100 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 13 ms 1360 KB Output is correct
14 Correct 14 ms 1268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 7 ms 752 KB Output is correct
9 Correct 15 ms 1336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1100 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 13 ms 1360 KB Output is correct
14 Correct 14 ms 1268 KB Output is correct
15 Correct 39 ms 3212 KB Output is correct
16 Correct 42 ms 3216 KB Output is correct
17 Correct 33 ms 3012 KB Output is correct
18 Correct 44 ms 2880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 7 ms 752 KB Output is correct
9 Correct 15 ms 1336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1100 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 13 ms 1360 KB Output is correct
14 Correct 14 ms 1268 KB Output is correct
15 Correct 39 ms 3212 KB Output is correct
16 Correct 42 ms 3216 KB Output is correct
17 Correct 33 ms 3012 KB Output is correct
18 Correct 44 ms 2880 KB Output is correct
19 Correct 41 ms 3224 KB Output is correct
20 Correct 47 ms 3224 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 42 ms 2996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 7 ms 752 KB Output is correct
9 Correct 15 ms 1336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1100 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 13 ms 1360 KB Output is correct
14 Correct 14 ms 1268 KB Output is correct
15 Correct 39 ms 3212 KB Output is correct
16 Correct 42 ms 3216 KB Output is correct
17 Correct 33 ms 3012 KB Output is correct
18 Correct 44 ms 2880 KB Output is correct
19 Correct 41 ms 3224 KB Output is correct
20 Correct 47 ms 3224 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 42 ms 2996 KB Output is correct
23 Correct 46 ms 3364 KB Output is correct
24 Correct 44 ms 3280 KB Output is correct
25 Correct 34 ms 3120 KB Output is correct
26 Correct 42 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 7 ms 752 KB Output is correct
9 Correct 15 ms 1336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1100 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 13 ms 1360 KB Output is correct
14 Correct 14 ms 1268 KB Output is correct
15 Correct 39 ms 3212 KB Output is correct
16 Correct 42 ms 3216 KB Output is correct
17 Correct 33 ms 3012 KB Output is correct
18 Correct 44 ms 2880 KB Output is correct
19 Correct 41 ms 3224 KB Output is correct
20 Correct 47 ms 3224 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 42 ms 2996 KB Output is correct
23 Correct 46 ms 3364 KB Output is correct
24 Correct 44 ms 3280 KB Output is correct
25 Correct 34 ms 3120 KB Output is correct
26 Correct 42 ms 3036 KB Output is correct
27 Incorrect 47 ms 3308 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 7 ms 752 KB Output is correct
9 Correct 15 ms 1336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1100 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 13 ms 1360 KB Output is correct
14 Correct 14 ms 1268 KB Output is correct
15 Correct 39 ms 3212 KB Output is correct
16 Correct 42 ms 3216 KB Output is correct
17 Correct 33 ms 3012 KB Output is correct
18 Correct 44 ms 2880 KB Output is correct
19 Correct 41 ms 3224 KB Output is correct
20 Correct 47 ms 3224 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 42 ms 2996 KB Output is correct
23 Correct 46 ms 3364 KB Output is correct
24 Correct 44 ms 3280 KB Output is correct
25 Correct 34 ms 3120 KB Output is correct
26 Correct 42 ms 3036 KB Output is correct
27 Incorrect 47 ms 3308 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 7 ms 752 KB Output is correct
9 Correct 15 ms 1336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1100 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 13 ms 1360 KB Output is correct
14 Correct 14 ms 1268 KB Output is correct
15 Correct 39 ms 3212 KB Output is correct
16 Correct 42 ms 3216 KB Output is correct
17 Correct 33 ms 3012 KB Output is correct
18 Correct 44 ms 2880 KB Output is correct
19 Correct 41 ms 3224 KB Output is correct
20 Correct 47 ms 3224 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 42 ms 2996 KB Output is correct
23 Correct 46 ms 3364 KB Output is correct
24 Correct 44 ms 3280 KB Output is correct
25 Correct 34 ms 3120 KB Output is correct
26 Correct 42 ms 3036 KB Output is correct
27 Incorrect 47 ms 3308 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -