답안 #530330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
530330 2022-02-25T05:24:25 Z fhvirus Minerals (JOI19_minerals) C++17
100 / 100
67 ms 3272 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

bool query(int x) {
	static int lst = 0;
	int cur = Query(x);
	int ans = lst ^ cur;
	lst = cur;
	return ans;
}

void solve(vector<int> a, vector<int> b, bool in) {
	int n = a.size(), m = ceil(n * .38);
	if (n == 0) return;
	if (n == 1) { Answer(a[0], b[0]); return; }
	if (in) {
		m = n - m;
		for (int i = n - 1; i >= m; --i) query(a[i]);
	} else
		for (int i = 0; i < m; ++i) query(a[i]);
	random_shuffle(begin(b), end(b));
	vector<int> bl, br;
	for (const int& i: b) {
		bool go_l = (bl.size() < m and (br.size() == n - m or !query(i)));
		(go_l ? bl : br).emplace_back(i);
	}
	solve(vector<int>(begin(a), begin(a) + m), bl, true);
	solve(vector<int>(begin(a) + m, end(a)), br, false);
}

}

void Solve(int N) {
	vector<int> a, b;
	for (int i = 1; i <= N * 2; ++i)
		(query(i) ? b : a).emplace_back(i);
	solve(a, b, true);
}

Compilation message

minerals.cpp: In function 'void {anonymous}::solve(std::vector<int>, std::vector<int>, bool)':
minerals.cpp:27:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |   bool go_l = (bl.size() < m and (br.size() == n - m or !query(i)));
      |                ~~~~~~~~~~^~~
minerals.cpp:27:45: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |   bool go_l = (bl.size() < m and (br.size() == n - m or !query(i)));
      |                                   ~~~~~~~~~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
2 Correct 2 ms 444 KB Output is correct
3 Correct 4 ms 584 KB Output is correct
4 Correct 8 ms 748 KB Output is correct
5 Correct 17 ms 1224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 584 KB Output is correct
8 Correct 8 ms 748 KB Output is correct
9 Correct 17 ms 1224 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 10 ms 1008 KB Output is correct
12 Correct 15 ms 1352 KB Output is correct
13 Correct 17 ms 1300 KB Output is correct
14 Correct 16 ms 1336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 584 KB Output is correct
8 Correct 8 ms 748 KB Output is correct
9 Correct 17 ms 1224 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 10 ms 1008 KB Output is correct
12 Correct 15 ms 1352 KB Output is correct
13 Correct 17 ms 1300 KB Output is correct
14 Correct 16 ms 1336 KB Output is correct
15 Correct 51 ms 3004 KB Output is correct
16 Correct 51 ms 3016 KB Output is correct
17 Correct 40 ms 3032 KB Output is correct
18 Correct 39 ms 2788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 584 KB Output is correct
8 Correct 8 ms 748 KB Output is correct
9 Correct 17 ms 1224 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 10 ms 1008 KB Output is correct
12 Correct 15 ms 1352 KB Output is correct
13 Correct 17 ms 1300 KB Output is correct
14 Correct 16 ms 1336 KB Output is correct
15 Correct 51 ms 3004 KB Output is correct
16 Correct 51 ms 3016 KB Output is correct
17 Correct 40 ms 3032 KB Output is correct
18 Correct 39 ms 2788 KB Output is correct
19 Correct 46 ms 3140 KB Output is correct
20 Correct 53 ms 3076 KB Output is correct
21 Correct 50 ms 3128 KB Output is correct
22 Correct 50 ms 2960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 584 KB Output is correct
8 Correct 8 ms 748 KB Output is correct
9 Correct 17 ms 1224 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 10 ms 1008 KB Output is correct
12 Correct 15 ms 1352 KB Output is correct
13 Correct 17 ms 1300 KB Output is correct
14 Correct 16 ms 1336 KB Output is correct
15 Correct 51 ms 3004 KB Output is correct
16 Correct 51 ms 3016 KB Output is correct
17 Correct 40 ms 3032 KB Output is correct
18 Correct 39 ms 2788 KB Output is correct
19 Correct 46 ms 3140 KB Output is correct
20 Correct 53 ms 3076 KB Output is correct
21 Correct 50 ms 3128 KB Output is correct
22 Correct 50 ms 2960 KB Output is correct
23 Correct 50 ms 3192 KB Output is correct
24 Correct 45 ms 3156 KB Output is correct
25 Correct 42 ms 3196 KB Output is correct
26 Correct 42 ms 2928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 584 KB Output is correct
8 Correct 8 ms 748 KB Output is correct
9 Correct 17 ms 1224 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 10 ms 1008 KB Output is correct
12 Correct 15 ms 1352 KB Output is correct
13 Correct 17 ms 1300 KB Output is correct
14 Correct 16 ms 1336 KB Output is correct
15 Correct 51 ms 3004 KB Output is correct
16 Correct 51 ms 3016 KB Output is correct
17 Correct 40 ms 3032 KB Output is correct
18 Correct 39 ms 2788 KB Output is correct
19 Correct 46 ms 3140 KB Output is correct
20 Correct 53 ms 3076 KB Output is correct
21 Correct 50 ms 3128 KB Output is correct
22 Correct 50 ms 2960 KB Output is correct
23 Correct 50 ms 3192 KB Output is correct
24 Correct 45 ms 3156 KB Output is correct
25 Correct 42 ms 3196 KB Output is correct
26 Correct 42 ms 2928 KB Output is correct
27 Correct 48 ms 3172 KB Output is correct
28 Correct 50 ms 3244 KB Output is correct
29 Correct 51 ms 3188 KB Output is correct
30 Correct 48 ms 3012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 584 KB Output is correct
8 Correct 8 ms 748 KB Output is correct
9 Correct 17 ms 1224 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 10 ms 1008 KB Output is correct
12 Correct 15 ms 1352 KB Output is correct
13 Correct 17 ms 1300 KB Output is correct
14 Correct 16 ms 1336 KB Output is correct
15 Correct 51 ms 3004 KB Output is correct
16 Correct 51 ms 3016 KB Output is correct
17 Correct 40 ms 3032 KB Output is correct
18 Correct 39 ms 2788 KB Output is correct
19 Correct 46 ms 3140 KB Output is correct
20 Correct 53 ms 3076 KB Output is correct
21 Correct 50 ms 3128 KB Output is correct
22 Correct 50 ms 2960 KB Output is correct
23 Correct 50 ms 3192 KB Output is correct
24 Correct 45 ms 3156 KB Output is correct
25 Correct 42 ms 3196 KB Output is correct
26 Correct 42 ms 2928 KB Output is correct
27 Correct 48 ms 3172 KB Output is correct
28 Correct 50 ms 3244 KB Output is correct
29 Correct 51 ms 3188 KB Output is correct
30 Correct 48 ms 3012 KB Output is correct
31 Correct 53 ms 3248 KB Output is correct
32 Correct 49 ms 3264 KB Output is correct
33 Correct 43 ms 3204 KB Output is correct
34 Correct 43 ms 3120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 380 KB Output is correct
6 Correct 2 ms 444 KB Output is correct
7 Correct 4 ms 584 KB Output is correct
8 Correct 8 ms 748 KB Output is correct
9 Correct 17 ms 1224 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 10 ms 1008 KB Output is correct
12 Correct 15 ms 1352 KB Output is correct
13 Correct 17 ms 1300 KB Output is correct
14 Correct 16 ms 1336 KB Output is correct
15 Correct 51 ms 3004 KB Output is correct
16 Correct 51 ms 3016 KB Output is correct
17 Correct 40 ms 3032 KB Output is correct
18 Correct 39 ms 2788 KB Output is correct
19 Correct 46 ms 3140 KB Output is correct
20 Correct 53 ms 3076 KB Output is correct
21 Correct 50 ms 3128 KB Output is correct
22 Correct 50 ms 2960 KB Output is correct
23 Correct 50 ms 3192 KB Output is correct
24 Correct 45 ms 3156 KB Output is correct
25 Correct 42 ms 3196 KB Output is correct
26 Correct 42 ms 2928 KB Output is correct
27 Correct 48 ms 3172 KB Output is correct
28 Correct 50 ms 3244 KB Output is correct
29 Correct 51 ms 3188 KB Output is correct
30 Correct 48 ms 3012 KB Output is correct
31 Correct 53 ms 3248 KB Output is correct
32 Correct 49 ms 3264 KB Output is correct
33 Correct 43 ms 3204 KB Output is correct
34 Correct 43 ms 3120 KB Output is correct
35 Correct 67 ms 3264 KB Output is correct
36 Correct 50 ms 3248 KB Output is correct
37 Correct 50 ms 3272 KB Output is correct
38 Correct 45 ms 3088 KB Output is correct