Submission #502705

# Submission time Handle Problem Language Result Execution time Memory
502705 2022-01-06T13:19:53 Z sidon Minerals (JOI19_minerals) C++17
90 / 100
37 ms 2808 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
 
const int LIM = 43e3;
 
int A[LIM], L, R = -1, last;
 
#define ask(Z) (last = Query(Z))
 
void dfs(int l, int r, vector<int> b, bool on) {
	if(r - l < 1) return;
	if(r - l < 2) return Answer(A[l], b[0]);
 
	int m = (l + r) / 2;
	if(l < m-1 && m - l == r - m) --m;
	if(l < m-1 && m - l + 1 == r - m) --m;
 
	for(int i = l; i < m; ++i)
		ask(A[i]);
 
	vector<int> bL, bR;
 
	for(int &i : b) {
		if((int)size(bL) == m - l) {
			bR.push_back(i);
			continue;
		}
		if((int)size(bR) == r - m) {
			bL.push_back(i);
			continue;
		}
		int prev = last;
		((prev == ask(i)) ^ on ? bL : bR).push_back(i);
	}
 
	dfs(l, m, bL, on ^ 1);
	dfs(m, r, bR, on);
}
 
void Solve(int N) {
 	vector<int> b;
 
	for(int i = 1; i <= N+N; ++i) {
		if(R == N - 1 || ask(i) < R + 2) {
			b.push_back(i);
		} else A[++R] = i;
	}
	dfs(0, N, b, 1);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 2 ms 328 KB Output is correct
3 Correct 3 ms 456 KB Output is correct
4 Correct 5 ms 620 KB Output is correct
5 Correct 11 ms 1064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1124 KB Output is correct
14 Correct 9 ms 968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1124 KB Output is correct
14 Correct 9 ms 968 KB Output is correct
15 Correct 28 ms 2480 KB Output is correct
16 Correct 29 ms 2496 KB Output is correct
17 Correct 20 ms 2412 KB Output is correct
18 Correct 32 ms 2212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1124 KB Output is correct
14 Correct 9 ms 968 KB Output is correct
15 Correct 28 ms 2480 KB Output is correct
16 Correct 29 ms 2496 KB Output is correct
17 Correct 20 ms 2412 KB Output is correct
18 Correct 32 ms 2212 KB Output is correct
19 Correct 30 ms 2548 KB Output is correct
20 Correct 35 ms 2516 KB Output is correct
21 Correct 27 ms 2396 KB Output is correct
22 Correct 24 ms 2232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1124 KB Output is correct
14 Correct 9 ms 968 KB Output is correct
15 Correct 28 ms 2480 KB Output is correct
16 Correct 29 ms 2496 KB Output is correct
17 Correct 20 ms 2412 KB Output is correct
18 Correct 32 ms 2212 KB Output is correct
19 Correct 30 ms 2548 KB Output is correct
20 Correct 35 ms 2516 KB Output is correct
21 Correct 27 ms 2396 KB Output is correct
22 Correct 24 ms 2232 KB Output is correct
23 Correct 32 ms 2600 KB Output is correct
24 Correct 31 ms 2520 KB Output is correct
25 Correct 22 ms 2488 KB Output is correct
26 Correct 25 ms 2344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1124 KB Output is correct
14 Correct 9 ms 968 KB Output is correct
15 Correct 28 ms 2480 KB Output is correct
16 Correct 29 ms 2496 KB Output is correct
17 Correct 20 ms 2412 KB Output is correct
18 Correct 32 ms 2212 KB Output is correct
19 Correct 30 ms 2548 KB Output is correct
20 Correct 35 ms 2516 KB Output is correct
21 Correct 27 ms 2396 KB Output is correct
22 Correct 24 ms 2232 KB Output is correct
23 Correct 32 ms 2600 KB Output is correct
24 Correct 31 ms 2520 KB Output is correct
25 Correct 22 ms 2488 KB Output is correct
26 Correct 25 ms 2344 KB Output is correct
27 Correct 34 ms 2680 KB Output is correct
28 Correct 31 ms 2640 KB Output is correct
29 Correct 23 ms 2564 KB Output is correct
30 Correct 23 ms 2332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1124 KB Output is correct
14 Correct 9 ms 968 KB Output is correct
15 Correct 28 ms 2480 KB Output is correct
16 Correct 29 ms 2496 KB Output is correct
17 Correct 20 ms 2412 KB Output is correct
18 Correct 32 ms 2212 KB Output is correct
19 Correct 30 ms 2548 KB Output is correct
20 Correct 35 ms 2516 KB Output is correct
21 Correct 27 ms 2396 KB Output is correct
22 Correct 24 ms 2232 KB Output is correct
23 Correct 32 ms 2600 KB Output is correct
24 Correct 31 ms 2520 KB Output is correct
25 Correct 22 ms 2488 KB Output is correct
26 Correct 25 ms 2344 KB Output is correct
27 Correct 34 ms 2680 KB Output is correct
28 Correct 31 ms 2640 KB Output is correct
29 Correct 23 ms 2564 KB Output is correct
30 Correct 23 ms 2332 KB Output is correct
31 Correct 32 ms 2692 KB Output is correct
32 Correct 31 ms 2668 KB Output is correct
33 Correct 23 ms 2620 KB Output is correct
34 Correct 25 ms 2492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 11 ms 1064 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1124 KB Output is correct
14 Correct 9 ms 968 KB Output is correct
15 Correct 28 ms 2480 KB Output is correct
16 Correct 29 ms 2496 KB Output is correct
17 Correct 20 ms 2412 KB Output is correct
18 Correct 32 ms 2212 KB Output is correct
19 Correct 30 ms 2548 KB Output is correct
20 Correct 35 ms 2516 KB Output is correct
21 Correct 27 ms 2396 KB Output is correct
22 Correct 24 ms 2232 KB Output is correct
23 Correct 32 ms 2600 KB Output is correct
24 Correct 31 ms 2520 KB Output is correct
25 Correct 22 ms 2488 KB Output is correct
26 Correct 25 ms 2344 KB Output is correct
27 Correct 34 ms 2680 KB Output is correct
28 Correct 31 ms 2640 KB Output is correct
29 Correct 23 ms 2564 KB Output is correct
30 Correct 23 ms 2332 KB Output is correct
31 Correct 32 ms 2692 KB Output is correct
32 Correct 31 ms 2668 KB Output is correct
33 Correct 23 ms 2620 KB Output is correct
34 Correct 25 ms 2492 KB Output is correct
35 Incorrect 37 ms 2808 KB Wrong Answer [2]
36 Halted 0 ms 0 KB -