답안 #502668

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502668 2022-01-06T12:10:57 Z sidon Minerals (JOI19_minerals) C++17
85 / 100
48 ms 2804 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

const int LIM = 43e3;

int A[LIM], L, R = -1, last;
bool in[LIM*2+1];

#define ask(Z) (last = Query(Z))

void extend(int lv, int rv) {
	for(int _ : {1, 0}){
		for(int i = L; i <= R; ++i) 
			if(!(lv <= i && i <= rv)) ask(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);
			continue;
		}
		if((int)size(bR) == r - m) {
			bL.push_back(i);
			continue;
		}
		int prev = last;
		(prev == ask(i) ? bL : bR).push_back(i);
		in[i] ^= 1;
	}

	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 || ask(i) < R + 2) {
			b.push_back(i);
			in[i] = 1;
		} else A[++R] = i;
	}
	dfs(0, N, b);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
# 결과 실행 시간 메모리 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 7 ms 740 KB Output is correct
5 Correct 13 ms 1076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 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 7 ms 740 KB Output is correct
9 Correct 13 ms 1076 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 11 ms 840 KB Output is correct
12 Correct 14 ms 1176 KB Output is correct
13 Correct 12 ms 1120 KB Output is correct
14 Correct 11 ms 1092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 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 7 ms 740 KB Output is correct
9 Correct 13 ms 1076 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 11 ms 840 KB Output is correct
12 Correct 14 ms 1176 KB Output is correct
13 Correct 12 ms 1120 KB Output is correct
14 Correct 11 ms 1092 KB Output is correct
15 Correct 41 ms 2596 KB Output is correct
16 Correct 35 ms 2544 KB Output is correct
17 Correct 25 ms 2396 KB Output is correct
18 Correct 24 ms 2300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 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 7 ms 740 KB Output is correct
9 Correct 13 ms 1076 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 11 ms 840 KB Output is correct
12 Correct 14 ms 1176 KB Output is correct
13 Correct 12 ms 1120 KB Output is correct
14 Correct 11 ms 1092 KB Output is correct
15 Correct 41 ms 2596 KB Output is correct
16 Correct 35 ms 2544 KB Output is correct
17 Correct 25 ms 2396 KB Output is correct
18 Correct 24 ms 2300 KB Output is correct
19 Correct 42 ms 2612 KB Output is correct
20 Correct 41 ms 2552 KB Output is correct
21 Correct 25 ms 2476 KB Output is correct
22 Correct 33 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 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 7 ms 740 KB Output is correct
9 Correct 13 ms 1076 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 11 ms 840 KB Output is correct
12 Correct 14 ms 1176 KB Output is correct
13 Correct 12 ms 1120 KB Output is correct
14 Correct 11 ms 1092 KB Output is correct
15 Correct 41 ms 2596 KB Output is correct
16 Correct 35 ms 2544 KB Output is correct
17 Correct 25 ms 2396 KB Output is correct
18 Correct 24 ms 2300 KB Output is correct
19 Correct 42 ms 2612 KB Output is correct
20 Correct 41 ms 2552 KB Output is correct
21 Correct 25 ms 2476 KB Output is correct
22 Correct 33 ms 2384 KB Output is correct
23 Correct 31 ms 2660 KB Output is correct
24 Correct 38 ms 2596 KB Output is correct
25 Correct 26 ms 2600 KB Output is correct
26 Correct 34 ms 2388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 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 7 ms 740 KB Output is correct
9 Correct 13 ms 1076 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 11 ms 840 KB Output is correct
12 Correct 14 ms 1176 KB Output is correct
13 Correct 12 ms 1120 KB Output is correct
14 Correct 11 ms 1092 KB Output is correct
15 Correct 41 ms 2596 KB Output is correct
16 Correct 35 ms 2544 KB Output is correct
17 Correct 25 ms 2396 KB Output is correct
18 Correct 24 ms 2300 KB Output is correct
19 Correct 42 ms 2612 KB Output is correct
20 Correct 41 ms 2552 KB Output is correct
21 Correct 25 ms 2476 KB Output is correct
22 Correct 33 ms 2384 KB Output is correct
23 Correct 31 ms 2660 KB Output is correct
24 Correct 38 ms 2596 KB Output is correct
25 Correct 26 ms 2600 KB Output is correct
26 Correct 34 ms 2388 KB Output is correct
27 Correct 48 ms 2716 KB Output is correct
28 Correct 36 ms 2716 KB Output is correct
29 Correct 26 ms 2656 KB Output is correct
30 Correct 26 ms 2412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 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 7 ms 740 KB Output is correct
9 Correct 13 ms 1076 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 11 ms 840 KB Output is correct
12 Correct 14 ms 1176 KB Output is correct
13 Correct 12 ms 1120 KB Output is correct
14 Correct 11 ms 1092 KB Output is correct
15 Correct 41 ms 2596 KB Output is correct
16 Correct 35 ms 2544 KB Output is correct
17 Correct 25 ms 2396 KB Output is correct
18 Correct 24 ms 2300 KB Output is correct
19 Correct 42 ms 2612 KB Output is correct
20 Correct 41 ms 2552 KB Output is correct
21 Correct 25 ms 2476 KB Output is correct
22 Correct 33 ms 2384 KB Output is correct
23 Correct 31 ms 2660 KB Output is correct
24 Correct 38 ms 2596 KB Output is correct
25 Correct 26 ms 2600 KB Output is correct
26 Correct 34 ms 2388 KB Output is correct
27 Correct 48 ms 2716 KB Output is correct
28 Correct 36 ms 2716 KB Output is correct
29 Correct 26 ms 2656 KB Output is correct
30 Correct 26 ms 2412 KB Output is correct
31 Incorrect 40 ms 2804 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 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 7 ms 740 KB Output is correct
9 Correct 13 ms 1076 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 11 ms 840 KB Output is correct
12 Correct 14 ms 1176 KB Output is correct
13 Correct 12 ms 1120 KB Output is correct
14 Correct 11 ms 1092 KB Output is correct
15 Correct 41 ms 2596 KB Output is correct
16 Correct 35 ms 2544 KB Output is correct
17 Correct 25 ms 2396 KB Output is correct
18 Correct 24 ms 2300 KB Output is correct
19 Correct 42 ms 2612 KB Output is correct
20 Correct 41 ms 2552 KB Output is correct
21 Correct 25 ms 2476 KB Output is correct
22 Correct 33 ms 2384 KB Output is correct
23 Correct 31 ms 2660 KB Output is correct
24 Correct 38 ms 2596 KB Output is correct
25 Correct 26 ms 2600 KB Output is correct
26 Correct 34 ms 2388 KB Output is correct
27 Correct 48 ms 2716 KB Output is correct
28 Correct 36 ms 2716 KB Output is correct
29 Correct 26 ms 2656 KB Output is correct
30 Correct 26 ms 2412 KB Output is correct
31 Incorrect 40 ms 2804 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -