답안 #520075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
520075 2022-01-28T09:44:20 Z drkarlicio2107 Minerals (JOI19_minerals) C++14
90 / 100
85 ms 3480 KB
#include <bits/stdc++.h>
#include "minerals.h"
using namespace std; vector <int> a, b;
int cnt=0;
int diff (int x){
	int a=Query (x);
	if (a!=cnt){
		cnt=a; return 1;
	}
	else{
		cnt=a; return 0;
	}
}
void solve (vector <int> a, vector <int> b, int x){
	random_shuffle (a.begin(), a.end());
	random_shuffle (b.begin(), b.end());
	if (a.size()==1){
		Answer (a[0], b[0]); return ;
	}
	int mid=a.size()/2;
	vector <int> a1, a2, b1, b2;
	for(int i=0; i<a.size(); i++){
        if(i<mid) a1.push_back(a[i]);
        else a2.push_back(a[i]);
        if((i>=mid)^x) diff(a[i]);
    }
	for (int i=0; i<b.size(); i++){
		if (b1.size()==a1.size()) b2.push_back(b[i]);
		else if (b2.size()==a2.size()) b1.push_back(b[i]);
		else if (diff (b[i])) b1.push_back(b[i]);
		else b2.push_back(b[i]);
	}
	solve (a1, b1, 0);
	solve (a2, b2, 1);
}
void Solve(int n){
	for (int i=1; i<2*n+1; i++){
		if (diff (i)) b.push_back(i);
		else a.push_back(i);
	}
	solve (a,b,1);
}

Compilation message

minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>, int)':
minerals.cpp:22:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int i=0; i<a.size(); i++){
      |               ~^~~~~~~~~
minerals.cpp:27:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for (int i=0; i<b.size(); 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 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 328 KB Output is correct
2 Correct 3 ms 328 KB Output is correct
3 Correct 5 ms 456 KB Output is correct
4 Correct 14 ms 720 KB Output is correct
5 Correct 24 ms 1312 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 1 ms 200 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 5 ms 456 KB Output is correct
8 Correct 14 ms 720 KB Output is correct
9 Correct 24 ms 1312 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 14 ms 1016 KB Output is correct
12 Correct 22 ms 1352 KB Output is correct
13 Correct 20 ms 1352 KB Output is correct
14 Correct 21 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 1 ms 200 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 5 ms 456 KB Output is correct
8 Correct 14 ms 720 KB Output is correct
9 Correct 24 ms 1312 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 14 ms 1016 KB Output is correct
12 Correct 22 ms 1352 KB Output is correct
13 Correct 20 ms 1352 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 64 ms 3100 KB Output is correct
16 Correct 62 ms 3128 KB Output is correct
17 Correct 64 ms 3200 KB Output is correct
18 Correct 60 ms 2932 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 1 ms 200 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 5 ms 456 KB Output is correct
8 Correct 14 ms 720 KB Output is correct
9 Correct 24 ms 1312 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 14 ms 1016 KB Output is correct
12 Correct 22 ms 1352 KB Output is correct
13 Correct 20 ms 1352 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 64 ms 3100 KB Output is correct
16 Correct 62 ms 3128 KB Output is correct
17 Correct 64 ms 3200 KB Output is correct
18 Correct 60 ms 2932 KB Output is correct
19 Correct 85 ms 3104 KB Output is correct
20 Correct 68 ms 3140 KB Output is correct
21 Correct 70 ms 3196 KB Output is correct
22 Correct 62 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 1 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 5 ms 456 KB Output is correct
8 Correct 14 ms 720 KB Output is correct
9 Correct 24 ms 1312 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 14 ms 1016 KB Output is correct
12 Correct 22 ms 1352 KB Output is correct
13 Correct 20 ms 1352 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 64 ms 3100 KB Output is correct
16 Correct 62 ms 3128 KB Output is correct
17 Correct 64 ms 3200 KB Output is correct
18 Correct 60 ms 2932 KB Output is correct
19 Correct 85 ms 3104 KB Output is correct
20 Correct 68 ms 3140 KB Output is correct
21 Correct 70 ms 3196 KB Output is correct
22 Correct 62 ms 3008 KB Output is correct
23 Correct 67 ms 3344 KB Output is correct
24 Correct 63 ms 3272 KB Output is correct
25 Correct 62 ms 3220 KB Output is correct
26 Correct 71 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 1 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 5 ms 456 KB Output is correct
8 Correct 14 ms 720 KB Output is correct
9 Correct 24 ms 1312 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 14 ms 1016 KB Output is correct
12 Correct 22 ms 1352 KB Output is correct
13 Correct 20 ms 1352 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 64 ms 3100 KB Output is correct
16 Correct 62 ms 3128 KB Output is correct
17 Correct 64 ms 3200 KB Output is correct
18 Correct 60 ms 2932 KB Output is correct
19 Correct 85 ms 3104 KB Output is correct
20 Correct 68 ms 3140 KB Output is correct
21 Correct 70 ms 3196 KB Output is correct
22 Correct 62 ms 3008 KB Output is correct
23 Correct 67 ms 3344 KB Output is correct
24 Correct 63 ms 3272 KB Output is correct
25 Correct 62 ms 3220 KB Output is correct
26 Correct 71 ms 3120 KB Output is correct
27 Correct 67 ms 3292 KB Output is correct
28 Correct 67 ms 3280 KB Output is correct
29 Correct 66 ms 3392 KB Output is correct
30 Correct 65 ms 3136 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 1 ms 200 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 5 ms 456 KB Output is correct
8 Correct 14 ms 720 KB Output is correct
9 Correct 24 ms 1312 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 14 ms 1016 KB Output is correct
12 Correct 22 ms 1352 KB Output is correct
13 Correct 20 ms 1352 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 64 ms 3100 KB Output is correct
16 Correct 62 ms 3128 KB Output is correct
17 Correct 64 ms 3200 KB Output is correct
18 Correct 60 ms 2932 KB Output is correct
19 Correct 85 ms 3104 KB Output is correct
20 Correct 68 ms 3140 KB Output is correct
21 Correct 70 ms 3196 KB Output is correct
22 Correct 62 ms 3008 KB Output is correct
23 Correct 67 ms 3344 KB Output is correct
24 Correct 63 ms 3272 KB Output is correct
25 Correct 62 ms 3220 KB Output is correct
26 Correct 71 ms 3120 KB Output is correct
27 Correct 67 ms 3292 KB Output is correct
28 Correct 67 ms 3280 KB Output is correct
29 Correct 66 ms 3392 KB Output is correct
30 Correct 65 ms 3136 KB Output is correct
31 Correct 67 ms 3440 KB Output is correct
32 Correct 69 ms 3380 KB Output is correct
33 Correct 76 ms 3320 KB Output is correct
34 Correct 66 ms 3244 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 1 ms 200 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 5 ms 456 KB Output is correct
8 Correct 14 ms 720 KB Output is correct
9 Correct 24 ms 1312 KB Output is correct
10 Correct 2 ms 328 KB Output is correct
11 Correct 14 ms 1016 KB Output is correct
12 Correct 22 ms 1352 KB Output is correct
13 Correct 20 ms 1352 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 64 ms 3100 KB Output is correct
16 Correct 62 ms 3128 KB Output is correct
17 Correct 64 ms 3200 KB Output is correct
18 Correct 60 ms 2932 KB Output is correct
19 Correct 85 ms 3104 KB Output is correct
20 Correct 68 ms 3140 KB Output is correct
21 Correct 70 ms 3196 KB Output is correct
22 Correct 62 ms 3008 KB Output is correct
23 Correct 67 ms 3344 KB Output is correct
24 Correct 63 ms 3272 KB Output is correct
25 Correct 62 ms 3220 KB Output is correct
26 Correct 71 ms 3120 KB Output is correct
27 Correct 67 ms 3292 KB Output is correct
28 Correct 67 ms 3280 KB Output is correct
29 Correct 66 ms 3392 KB Output is correct
30 Correct 65 ms 3136 KB Output is correct
31 Correct 67 ms 3440 KB Output is correct
32 Correct 69 ms 3380 KB Output is correct
33 Correct 76 ms 3320 KB Output is correct
34 Correct 66 ms 3244 KB Output is correct
35 Incorrect 74 ms 3480 KB Wrong Answer [2]
36 Halted 0 ms 0 KB -