답안 #530327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
530327 2022-02-25T05:17:17 Z fhvirus Minerals (JOI19_minerals) C++17
80 / 100
56 ms 3308 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 * .35);
	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 0 ms 200 KB Output is correct
4 Correct 1 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 4 ms 608 KB Output is correct
4 Correct 9 ms 840 KB Output is correct
5 Correct 19 ms 1352 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 1 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 4 ms 608 KB Output is correct
8 Correct 9 ms 840 KB Output is correct
9 Correct 19 ms 1352 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 992 KB Output is correct
12 Correct 18 ms 1352 KB Output is correct
13 Correct 16 ms 1412 KB Output is correct
14 Correct 15 ms 1404 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 1 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 4 ms 608 KB Output is correct
8 Correct 9 ms 840 KB Output is correct
9 Correct 19 ms 1352 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 992 KB Output is correct
12 Correct 18 ms 1352 KB Output is correct
13 Correct 16 ms 1412 KB Output is correct
14 Correct 15 ms 1404 KB Output is correct
15 Correct 43 ms 3132 KB Output is correct
16 Correct 48 ms 3048 KB Output is correct
17 Correct 42 ms 3100 KB Output is correct
18 Correct 42 ms 2984 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 1 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 4 ms 608 KB Output is correct
8 Correct 9 ms 840 KB Output is correct
9 Correct 19 ms 1352 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 992 KB Output is correct
12 Correct 18 ms 1352 KB Output is correct
13 Correct 16 ms 1412 KB Output is correct
14 Correct 15 ms 1404 KB Output is correct
15 Correct 43 ms 3132 KB Output is correct
16 Correct 48 ms 3048 KB Output is correct
17 Correct 42 ms 3100 KB Output is correct
18 Correct 42 ms 2984 KB Output is correct
19 Correct 56 ms 3184 KB Output is correct
20 Correct 46 ms 3136 KB Output is correct
21 Correct 41 ms 3136 KB Output is correct
22 Correct 41 ms 3008 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 1 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 4 ms 608 KB Output is correct
8 Correct 9 ms 840 KB Output is correct
9 Correct 19 ms 1352 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 992 KB Output is correct
12 Correct 18 ms 1352 KB Output is correct
13 Correct 16 ms 1412 KB Output is correct
14 Correct 15 ms 1404 KB Output is correct
15 Correct 43 ms 3132 KB Output is correct
16 Correct 48 ms 3048 KB Output is correct
17 Correct 42 ms 3100 KB Output is correct
18 Correct 42 ms 2984 KB Output is correct
19 Correct 56 ms 3184 KB Output is correct
20 Correct 46 ms 3136 KB Output is correct
21 Correct 41 ms 3136 KB Output is correct
22 Correct 41 ms 3008 KB Output is correct
23 Correct 46 ms 3308 KB Output is correct
24 Correct 51 ms 3204 KB Output is correct
25 Correct 54 ms 3260 KB Output is correct
26 Correct 45 ms 3104 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 1 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 4 ms 608 KB Output is correct
8 Correct 9 ms 840 KB Output is correct
9 Correct 19 ms 1352 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 992 KB Output is correct
12 Correct 18 ms 1352 KB Output is correct
13 Correct 16 ms 1412 KB Output is correct
14 Correct 15 ms 1404 KB Output is correct
15 Correct 43 ms 3132 KB Output is correct
16 Correct 48 ms 3048 KB Output is correct
17 Correct 42 ms 3100 KB Output is correct
18 Correct 42 ms 2984 KB Output is correct
19 Correct 56 ms 3184 KB Output is correct
20 Correct 46 ms 3136 KB Output is correct
21 Correct 41 ms 3136 KB Output is correct
22 Correct 41 ms 3008 KB Output is correct
23 Correct 46 ms 3308 KB Output is correct
24 Correct 51 ms 3204 KB Output is correct
25 Correct 54 ms 3260 KB Output is correct
26 Correct 45 ms 3104 KB Output is correct
27 Incorrect 48 ms 3288 KB Wrong Answer [2]
28 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 0 ms 200 KB Output is correct
4 Correct 1 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 4 ms 608 KB Output is correct
8 Correct 9 ms 840 KB Output is correct
9 Correct 19 ms 1352 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 992 KB Output is correct
12 Correct 18 ms 1352 KB Output is correct
13 Correct 16 ms 1412 KB Output is correct
14 Correct 15 ms 1404 KB Output is correct
15 Correct 43 ms 3132 KB Output is correct
16 Correct 48 ms 3048 KB Output is correct
17 Correct 42 ms 3100 KB Output is correct
18 Correct 42 ms 2984 KB Output is correct
19 Correct 56 ms 3184 KB Output is correct
20 Correct 46 ms 3136 KB Output is correct
21 Correct 41 ms 3136 KB Output is correct
22 Correct 41 ms 3008 KB Output is correct
23 Correct 46 ms 3308 KB Output is correct
24 Correct 51 ms 3204 KB Output is correct
25 Correct 54 ms 3260 KB Output is correct
26 Correct 45 ms 3104 KB Output is correct
27 Incorrect 48 ms 3288 KB Wrong Answer [2]
28 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 0 ms 200 KB Output is correct
4 Correct 1 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 4 ms 608 KB Output is correct
8 Correct 9 ms 840 KB Output is correct
9 Correct 19 ms 1352 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 992 KB Output is correct
12 Correct 18 ms 1352 KB Output is correct
13 Correct 16 ms 1412 KB Output is correct
14 Correct 15 ms 1404 KB Output is correct
15 Correct 43 ms 3132 KB Output is correct
16 Correct 48 ms 3048 KB Output is correct
17 Correct 42 ms 3100 KB Output is correct
18 Correct 42 ms 2984 KB Output is correct
19 Correct 56 ms 3184 KB Output is correct
20 Correct 46 ms 3136 KB Output is correct
21 Correct 41 ms 3136 KB Output is correct
22 Correct 41 ms 3008 KB Output is correct
23 Correct 46 ms 3308 KB Output is correct
24 Correct 51 ms 3204 KB Output is correct
25 Correct 54 ms 3260 KB Output is correct
26 Correct 45 ms 3104 KB Output is correct
27 Incorrect 48 ms 3288 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -