Submission #502649

# Submission time Handle Problem Language Result Execution time Memory
502649 2022-01-06T11:38:26 Z sidon Minerals (JOI19_minerals) C++17
40 / 100
36 ms 2460 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

const int LIM = 43e3;

int A[LIM], L, R = -1;

void extend(int lv, int rv) {
	for(int _ : {1, 0}){
		for(int i = L; i <= R; ++i) 
			if(!(lv <= i && i <= rv)) Query(A[i]);
		if(_) swap(L, lv), swap(R, rv);
	}
}

void dfs(int l, int r, vector<int> b) {
	if(r - l < 1) return;
	if(r - l < 2) return Answer(A[l], b[0]);

	int m = (l + r) / 2;
	if(r - m > m - l) ++m;

	extend(l, m-1);


	vector<int> bL, bR;

	for(int &i : b) {
		if((int)size(bL) == m - l) bR.push_back(i);
		else if((int)size(bR) == r - m) bL.push_back(i);
		else
			(Query(i) == Query(i) ? bL : bR).push_back(i);
	}

	dfs(l, m, bL);
	dfs(m, r, bR);
}

void Solve(int N) {
	vector<int> b;

	for(int i = 1; i <= N * 2; ++i) {
		if(R == N - 1 || Query(i) < R + 2) {
			b.push_back(i);
			Query(i);
		} else A[++R] = i;
	}
	dfs(0, N, b);
}
# 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 6 ms 712 KB Output is correct
5 Correct 15 ms 1084 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 6 ms 712 KB Output is correct
9 Correct 15 ms 1084 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 8 ms 840 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1060 KB Output is correct
14 Correct 13 ms 1020 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 6 ms 712 KB Output is correct
9 Correct 15 ms 1084 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 8 ms 840 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1060 KB Output is correct
14 Correct 13 ms 1020 KB Output is correct
15 Incorrect 36 ms 2460 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 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 6 ms 712 KB Output is correct
9 Correct 15 ms 1084 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 8 ms 840 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1060 KB Output is correct
14 Correct 13 ms 1020 KB Output is correct
15 Incorrect 36 ms 2460 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 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 6 ms 712 KB Output is correct
9 Correct 15 ms 1084 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 8 ms 840 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1060 KB Output is correct
14 Correct 13 ms 1020 KB Output is correct
15 Incorrect 36 ms 2460 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 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 6 ms 712 KB Output is correct
9 Correct 15 ms 1084 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 8 ms 840 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1060 KB Output is correct
14 Correct 13 ms 1020 KB Output is correct
15 Incorrect 36 ms 2460 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 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 6 ms 712 KB Output is correct
9 Correct 15 ms 1084 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 8 ms 840 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1060 KB Output is correct
14 Correct 13 ms 1020 KB Output is correct
15 Incorrect 36 ms 2460 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -
# 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 6 ms 712 KB Output is correct
9 Correct 15 ms 1084 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 8 ms 840 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1060 KB Output is correct
14 Correct 13 ms 1020 KB Output is correct
15 Incorrect 36 ms 2460 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -