답안 #530328

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
530328 2022-02-25T05:18:21 Z fhvirus Minerals (JOI19_minerals) C++17
85 / 100
62 ms 3304 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 * .40);
	if (n == 0) return;
	if (n == 1) { Answer(a[0], b[0]); return; }
	if (in) 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:24:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |   bool go_l = (bl.size() < m and (br.size() == n - m or !query(i)));
      |                ~~~~~~~~~~^~~
minerals.cpp:24:45: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |   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 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 3 ms 456 KB Output is correct
3 Correct 5 ms 584 KB Output is correct
4 Correct 11 ms 876 KB Output is correct
5 Correct 17 ms 1264 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 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 3 ms 456 KB Output is correct
7 Correct 5 ms 584 KB Output is correct
8 Correct 11 ms 876 KB Output is correct
9 Correct 17 ms 1264 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 12 ms 968 KB Output is correct
12 Correct 17 ms 1392 KB Output is correct
13 Correct 15 ms 1340 KB Output is correct
14 Correct 19 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 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 3 ms 456 KB Output is correct
7 Correct 5 ms 584 KB Output is correct
8 Correct 11 ms 876 KB Output is correct
9 Correct 17 ms 1264 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 12 ms 968 KB Output is correct
12 Correct 17 ms 1392 KB Output is correct
13 Correct 15 ms 1340 KB Output is correct
14 Correct 19 ms 1224 KB Output is correct
15 Correct 44 ms 2960 KB Output is correct
16 Correct 45 ms 3036 KB Output is correct
17 Correct 49 ms 2984 KB Output is correct
18 Correct 53 ms 2800 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 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 3 ms 456 KB Output is correct
7 Correct 5 ms 584 KB Output is correct
8 Correct 11 ms 876 KB Output is correct
9 Correct 17 ms 1264 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 12 ms 968 KB Output is correct
12 Correct 17 ms 1392 KB Output is correct
13 Correct 15 ms 1340 KB Output is correct
14 Correct 19 ms 1224 KB Output is correct
15 Correct 44 ms 2960 KB Output is correct
16 Correct 45 ms 3036 KB Output is correct
17 Correct 49 ms 2984 KB Output is correct
18 Correct 53 ms 2800 KB Output is correct
19 Correct 46 ms 3044 KB Output is correct
20 Correct 51 ms 3028 KB Output is correct
21 Correct 41 ms 3008 KB Output is correct
22 Correct 40 ms 2892 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 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 3 ms 456 KB Output is correct
7 Correct 5 ms 584 KB Output is correct
8 Correct 11 ms 876 KB Output is correct
9 Correct 17 ms 1264 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 12 ms 968 KB Output is correct
12 Correct 17 ms 1392 KB Output is correct
13 Correct 15 ms 1340 KB Output is correct
14 Correct 19 ms 1224 KB Output is correct
15 Correct 44 ms 2960 KB Output is correct
16 Correct 45 ms 3036 KB Output is correct
17 Correct 49 ms 2984 KB Output is correct
18 Correct 53 ms 2800 KB Output is correct
19 Correct 46 ms 3044 KB Output is correct
20 Correct 51 ms 3028 KB Output is correct
21 Correct 41 ms 3008 KB Output is correct
22 Correct 40 ms 2892 KB Output is correct
23 Correct 55 ms 3296 KB Output is correct
24 Correct 62 ms 3036 KB Output is correct
25 Correct 44 ms 3084 KB Output is correct
26 Correct 48 ms 3016 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 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 3 ms 456 KB Output is correct
7 Correct 5 ms 584 KB Output is correct
8 Correct 11 ms 876 KB Output is correct
9 Correct 17 ms 1264 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 12 ms 968 KB Output is correct
12 Correct 17 ms 1392 KB Output is correct
13 Correct 15 ms 1340 KB Output is correct
14 Correct 19 ms 1224 KB Output is correct
15 Correct 44 ms 2960 KB Output is correct
16 Correct 45 ms 3036 KB Output is correct
17 Correct 49 ms 2984 KB Output is correct
18 Correct 53 ms 2800 KB Output is correct
19 Correct 46 ms 3044 KB Output is correct
20 Correct 51 ms 3028 KB Output is correct
21 Correct 41 ms 3008 KB Output is correct
22 Correct 40 ms 2892 KB Output is correct
23 Correct 55 ms 3296 KB Output is correct
24 Correct 62 ms 3036 KB Output is correct
25 Correct 44 ms 3084 KB Output is correct
26 Correct 48 ms 3016 KB Output is correct
27 Correct 52 ms 3184 KB Output is correct
28 Correct 47 ms 3264 KB Output is correct
29 Correct 46 ms 3240 KB Output is correct
30 Correct 45 ms 3112 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 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 3 ms 456 KB Output is correct
7 Correct 5 ms 584 KB Output is correct
8 Correct 11 ms 876 KB Output is correct
9 Correct 17 ms 1264 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 12 ms 968 KB Output is correct
12 Correct 17 ms 1392 KB Output is correct
13 Correct 15 ms 1340 KB Output is correct
14 Correct 19 ms 1224 KB Output is correct
15 Correct 44 ms 2960 KB Output is correct
16 Correct 45 ms 3036 KB Output is correct
17 Correct 49 ms 2984 KB Output is correct
18 Correct 53 ms 2800 KB Output is correct
19 Correct 46 ms 3044 KB Output is correct
20 Correct 51 ms 3028 KB Output is correct
21 Correct 41 ms 3008 KB Output is correct
22 Correct 40 ms 2892 KB Output is correct
23 Correct 55 ms 3296 KB Output is correct
24 Correct 62 ms 3036 KB Output is correct
25 Correct 44 ms 3084 KB Output is correct
26 Correct 48 ms 3016 KB Output is correct
27 Correct 52 ms 3184 KB Output is correct
28 Correct 47 ms 3264 KB Output is correct
29 Correct 46 ms 3240 KB Output is correct
30 Correct 45 ms 3112 KB Output is correct
31 Incorrect 52 ms 3304 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 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 3 ms 456 KB Output is correct
7 Correct 5 ms 584 KB Output is correct
8 Correct 11 ms 876 KB Output is correct
9 Correct 17 ms 1264 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 12 ms 968 KB Output is correct
12 Correct 17 ms 1392 KB Output is correct
13 Correct 15 ms 1340 KB Output is correct
14 Correct 19 ms 1224 KB Output is correct
15 Correct 44 ms 2960 KB Output is correct
16 Correct 45 ms 3036 KB Output is correct
17 Correct 49 ms 2984 KB Output is correct
18 Correct 53 ms 2800 KB Output is correct
19 Correct 46 ms 3044 KB Output is correct
20 Correct 51 ms 3028 KB Output is correct
21 Correct 41 ms 3008 KB Output is correct
22 Correct 40 ms 2892 KB Output is correct
23 Correct 55 ms 3296 KB Output is correct
24 Correct 62 ms 3036 KB Output is correct
25 Correct 44 ms 3084 KB Output is correct
26 Correct 48 ms 3016 KB Output is correct
27 Correct 52 ms 3184 KB Output is correct
28 Correct 47 ms 3264 KB Output is correct
29 Correct 46 ms 3240 KB Output is correct
30 Correct 45 ms 3112 KB Output is correct
31 Incorrect 52 ms 3304 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -