답안 #502729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502729 2022-01-06T14:03:01 Z sidon Minerals (JOI19_minerals) C++17
100 / 100
37 ms 2876 KB
#include "minerals.h"
#include <vector>
 
int A[43000], L, R = -1, last;
 
void dfs(int l, int r, auto 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;
	while(__builtin_popcount(m-l) > 2) --m;
 
	for(int i = l; i < m; ++i) last = Query(A[i]);
 
	std::vector<int> bL, bR;
 
	for(int &i : b) {
		int prev = last;
		(size(bR) == r - m || (size(bL) != m - l && (prev == (last = Query(i))) ^ on) ? bL : bR).push_back(i);
	}
	dfs(l, m, bL, on ^ 1);
	dfs(m, r, bR, on);
}
 
void Solve(int N) {
	std::vector<int> b;
	for(int i = 1; i <= N+N; ++i) 
		if(R == N - 1 || Query(i) < R + 2) b.push_back(i);
		else A[++R] = i;
	dfs(0, N, b, 1);
}

Compilation message

minerals.cpp:6:24: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
    6 | void dfs(int l, int r, auto b, bool on) {
      |                        ^~~~
minerals.cpp: In instantiation of 'void dfs(int, int, auto:1, bool) [with auto:1 = std::vector<int>]':
minerals.cpp:31:16:   required from here
minerals.cpp:20:13: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |   (size(bR) == r - m || (size(bL) != m - l && (prev == (last = Query(i))) ^ on) ? bL : bR).push_back(i);
      |    ~~~~~~~~~^~~~~~~~
minerals.cpp:20:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |   (size(bR) == r - m || (size(bL) != m - l && (prev == (last = Query(i))) ^ on) ? bL : bR).push_back(i);
      |                          ~~~~~~~~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
5 Correct 11 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
9 Correct 11 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 880 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1280 KB Output is correct
14 Correct 8 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
9 Correct 11 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 880 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1280 KB Output is correct
14 Correct 8 ms 1096 KB Output is correct
15 Correct 35 ms 2620 KB Output is correct
16 Correct 35 ms 2480 KB Output is correct
17 Correct 26 ms 2408 KB Output is correct
18 Correct 23 ms 2224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
9 Correct 11 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 880 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1280 KB Output is correct
14 Correct 8 ms 1096 KB Output is correct
15 Correct 35 ms 2620 KB Output is correct
16 Correct 35 ms 2480 KB Output is correct
17 Correct 26 ms 2408 KB Output is correct
18 Correct 23 ms 2224 KB Output is correct
19 Correct 30 ms 2488 KB Output is correct
20 Correct 37 ms 2496 KB Output is correct
21 Correct 29 ms 2544 KB Output is correct
22 Correct 24 ms 2364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
9 Correct 11 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 880 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1280 KB Output is correct
14 Correct 8 ms 1096 KB Output is correct
15 Correct 35 ms 2620 KB Output is correct
16 Correct 35 ms 2480 KB Output is correct
17 Correct 26 ms 2408 KB Output is correct
18 Correct 23 ms 2224 KB Output is correct
19 Correct 30 ms 2488 KB Output is correct
20 Correct 37 ms 2496 KB Output is correct
21 Correct 29 ms 2544 KB Output is correct
22 Correct 24 ms 2364 KB Output is correct
23 Correct 37 ms 2628 KB Output is correct
24 Correct 30 ms 2632 KB Output is correct
25 Correct 23 ms 2520 KB Output is correct
26 Correct 24 ms 2424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
9 Correct 11 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 880 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1280 KB Output is correct
14 Correct 8 ms 1096 KB Output is correct
15 Correct 35 ms 2620 KB Output is correct
16 Correct 35 ms 2480 KB Output is correct
17 Correct 26 ms 2408 KB Output is correct
18 Correct 23 ms 2224 KB Output is correct
19 Correct 30 ms 2488 KB Output is correct
20 Correct 37 ms 2496 KB Output is correct
21 Correct 29 ms 2544 KB Output is correct
22 Correct 24 ms 2364 KB Output is correct
23 Correct 37 ms 2628 KB Output is correct
24 Correct 30 ms 2632 KB Output is correct
25 Correct 23 ms 2520 KB Output is correct
26 Correct 24 ms 2424 KB Output is correct
27 Correct 35 ms 2640 KB Output is correct
28 Correct 35 ms 2576 KB Output is correct
29 Correct 23 ms 2620 KB Output is correct
30 Correct 28 ms 2500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
9 Correct 11 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 880 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1280 KB Output is correct
14 Correct 8 ms 1096 KB Output is correct
15 Correct 35 ms 2620 KB Output is correct
16 Correct 35 ms 2480 KB Output is correct
17 Correct 26 ms 2408 KB Output is correct
18 Correct 23 ms 2224 KB Output is correct
19 Correct 30 ms 2488 KB Output is correct
20 Correct 37 ms 2496 KB Output is correct
21 Correct 29 ms 2544 KB Output is correct
22 Correct 24 ms 2364 KB Output is correct
23 Correct 37 ms 2628 KB Output is correct
24 Correct 30 ms 2632 KB Output is correct
25 Correct 23 ms 2520 KB Output is correct
26 Correct 24 ms 2424 KB Output is correct
27 Correct 35 ms 2640 KB Output is correct
28 Correct 35 ms 2576 KB Output is correct
29 Correct 23 ms 2620 KB Output is correct
30 Correct 28 ms 2500 KB Output is correct
31 Correct 31 ms 2644 KB Output is correct
32 Correct 33 ms 2660 KB Output is correct
33 Correct 30 ms 2700 KB Output is correct
34 Correct 27 ms 2488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 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 6 ms 712 KB Output is correct
9 Correct 11 ms 1096 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 7 ms 880 KB Output is correct
12 Correct 11 ms 1096 KB Output is correct
13 Correct 9 ms 1280 KB Output is correct
14 Correct 8 ms 1096 KB Output is correct
15 Correct 35 ms 2620 KB Output is correct
16 Correct 35 ms 2480 KB Output is correct
17 Correct 26 ms 2408 KB Output is correct
18 Correct 23 ms 2224 KB Output is correct
19 Correct 30 ms 2488 KB Output is correct
20 Correct 37 ms 2496 KB Output is correct
21 Correct 29 ms 2544 KB Output is correct
22 Correct 24 ms 2364 KB Output is correct
23 Correct 37 ms 2628 KB Output is correct
24 Correct 30 ms 2632 KB Output is correct
25 Correct 23 ms 2520 KB Output is correct
26 Correct 24 ms 2424 KB Output is correct
27 Correct 35 ms 2640 KB Output is correct
28 Correct 35 ms 2576 KB Output is correct
29 Correct 23 ms 2620 KB Output is correct
30 Correct 28 ms 2500 KB Output is correct
31 Correct 31 ms 2644 KB Output is correct
32 Correct 33 ms 2660 KB Output is correct
33 Correct 30 ms 2700 KB Output is correct
34 Correct 27 ms 2488 KB Output is correct
35 Correct 33 ms 2876 KB Output is correct
36 Correct 36 ms 2800 KB Output is correct
37 Correct 25 ms 2716 KB Output is correct
38 Correct 25 ms 2524 KB Output is correct