답안 #502666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502666 2022-01-06T12:10:27 Z sidon Minerals (JOI19_minerals) C++17
85 / 100
38 ms 2772 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;

	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 1 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 1 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 10 ms 1096 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 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 1 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 10 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 908 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 11 ms 1108 KB Output is correct
14 Correct 9 ms 1044 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 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 1 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 10 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 908 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 11 ms 1108 KB Output is correct
14 Correct 9 ms 1044 KB Output is correct
15 Correct 38 ms 2596 KB Output is correct
16 Correct 30 ms 2580 KB Output is correct
17 Correct 23 ms 2468 KB Output is correct
18 Correct 31 ms 2216 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 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 1 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 10 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 908 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 11 ms 1108 KB Output is correct
14 Correct 9 ms 1044 KB Output is correct
15 Correct 38 ms 2596 KB Output is correct
16 Correct 30 ms 2580 KB Output is correct
17 Correct 23 ms 2468 KB Output is correct
18 Correct 31 ms 2216 KB Output is correct
19 Correct 34 ms 2568 KB Output is correct
20 Correct 36 ms 2572 KB Output is correct
21 Correct 23 ms 2536 KB Output is correct
22 Correct 22 ms 2332 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 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 1 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 10 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 908 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 11 ms 1108 KB Output is correct
14 Correct 9 ms 1044 KB Output is correct
15 Correct 38 ms 2596 KB Output is correct
16 Correct 30 ms 2580 KB Output is correct
17 Correct 23 ms 2468 KB Output is correct
18 Correct 31 ms 2216 KB Output is correct
19 Correct 34 ms 2568 KB Output is correct
20 Correct 36 ms 2572 KB Output is correct
21 Correct 23 ms 2536 KB Output is correct
22 Correct 22 ms 2332 KB Output is correct
23 Correct 37 ms 2632 KB Output is correct
24 Correct 33 ms 2628 KB Output is correct
25 Correct 23 ms 2556 KB Output is correct
26 Correct 31 ms 2348 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 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 1 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 10 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 908 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 11 ms 1108 KB Output is correct
14 Correct 9 ms 1044 KB Output is correct
15 Correct 38 ms 2596 KB Output is correct
16 Correct 30 ms 2580 KB Output is correct
17 Correct 23 ms 2468 KB Output is correct
18 Correct 31 ms 2216 KB Output is correct
19 Correct 34 ms 2568 KB Output is correct
20 Correct 36 ms 2572 KB Output is correct
21 Correct 23 ms 2536 KB Output is correct
22 Correct 22 ms 2332 KB Output is correct
23 Correct 37 ms 2632 KB Output is correct
24 Correct 33 ms 2628 KB Output is correct
25 Correct 23 ms 2556 KB Output is correct
26 Correct 31 ms 2348 KB Output is correct
27 Correct 38 ms 2672 KB Output is correct
28 Correct 33 ms 2656 KB Output is correct
29 Correct 25 ms 2696 KB Output is correct
30 Correct 31 ms 2476 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 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 1 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 10 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 908 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 11 ms 1108 KB Output is correct
14 Correct 9 ms 1044 KB Output is correct
15 Correct 38 ms 2596 KB Output is correct
16 Correct 30 ms 2580 KB Output is correct
17 Correct 23 ms 2468 KB Output is correct
18 Correct 31 ms 2216 KB Output is correct
19 Correct 34 ms 2568 KB Output is correct
20 Correct 36 ms 2572 KB Output is correct
21 Correct 23 ms 2536 KB Output is correct
22 Correct 22 ms 2332 KB Output is correct
23 Correct 37 ms 2632 KB Output is correct
24 Correct 33 ms 2628 KB Output is correct
25 Correct 23 ms 2556 KB Output is correct
26 Correct 31 ms 2348 KB Output is correct
27 Correct 38 ms 2672 KB Output is correct
28 Correct 33 ms 2656 KB Output is correct
29 Correct 25 ms 2696 KB Output is correct
30 Correct 31 ms 2476 KB Output is correct
31 Incorrect 32 ms 2772 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 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 1 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 10 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 908 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 11 ms 1108 KB Output is correct
14 Correct 9 ms 1044 KB Output is correct
15 Correct 38 ms 2596 KB Output is correct
16 Correct 30 ms 2580 KB Output is correct
17 Correct 23 ms 2468 KB Output is correct
18 Correct 31 ms 2216 KB Output is correct
19 Correct 34 ms 2568 KB Output is correct
20 Correct 36 ms 2572 KB Output is correct
21 Correct 23 ms 2536 KB Output is correct
22 Correct 22 ms 2332 KB Output is correct
23 Correct 37 ms 2632 KB Output is correct
24 Correct 33 ms 2628 KB Output is correct
25 Correct 23 ms 2556 KB Output is correct
26 Correct 31 ms 2348 KB Output is correct
27 Correct 38 ms 2672 KB Output is correct
28 Correct 33 ms 2656 KB Output is correct
29 Correct 25 ms 2696 KB Output is correct
30 Correct 31 ms 2476 KB Output is correct
31 Incorrect 32 ms 2772 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -