Submission #129771

# Submission time Handle Problem Language Result Execution time Memory
129771 2019-07-13T07:53:19 Z tjd229 Minerals (JOI19_minerals) C++14
100 / 100
68 ms 3832 KB
#include "minerals.h"
#include <vector>
using namespace std;
int last = 0;
void dvc(vector<int> X,vector<int> Y,int dir) {
	if (X.size() == 1) {
		Answer(X[0],Y[0]);
		return;
	}
	int m = 1+(X.size()*0.38);
	vector<int> X1,X2, Y1,Y2;
	if (dir) {
		while (X2.size() <m) {
			X2.push_back(X.back());
			last = Query(X.back());
			X.pop_back();
		}
		X1 = X;
	}
	else {
		while (X1.size() < m) {
			X1.push_back(X.back());
			last = Query(X.back());
			X.pop_back();
		}
		while (X.size()) {
			X2.push_back(X.back());
			X.pop_back();
		}
	}
	int i=0;
	for (i = 0; i < Y.size(); ++i) {
		if (X1.size() == Y1.size()) {
			while (X2.size() != Y2.size())
				Y2.push_back(Y[i++]);
			break;
		}
		if (X2.size() == Y2.size()) {
			while (X1.size() != Y1.size())
				Y1.push_back(Y[i++]);
			break;
		}
		int in = Query(Y[i]);
		if (last == in) Y1.push_back(Y[i]);
		else Y2.push_back(Y[i]);
		last = in;
	}


	dvc(X1, Y1, 1); dvc(X2, Y2, 0);
}
void Solve(int N) {
	int NN = N + N;
	vector<int> X,Y;
	
	for (int i = 1; i <= NN; ++i) {
		int in = Query(i);
		if (in == last) 
			Y.push_back(i);
		
		else X.push_back(i);
		last = in;
	}
	dvc(X, Y, 1);
	
	
}

Compilation message

minerals.cpp: In function 'void dvc(std::vector<int>, std::vector<int>, int)':
minerals.cpp:13:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (X2.size() <m) {
          ~~~~~~~~~~^~
minerals.cpp:21:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (X1.size() < m) {
          ~~~~~~~~~~^~~
minerals.cpp:32:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < Y.size(); ++i) {
              ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 508 KB Output is correct
3 Correct 7 ms 632 KB Output is correct
4 Correct 12 ms 1020 KB Output is correct
5 Correct 22 ms 1596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 7 ms 632 KB Output is correct
8 Correct 12 ms 1020 KB Output is correct
9 Correct 22 ms 1596 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 15 ms 1144 KB Output is correct
12 Correct 23 ms 1528 KB Output is correct
13 Correct 20 ms 1500 KB Output is correct
14 Correct 20 ms 1448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 7 ms 632 KB Output is correct
8 Correct 12 ms 1020 KB Output is correct
9 Correct 22 ms 1596 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 15 ms 1144 KB Output is correct
12 Correct 23 ms 1528 KB Output is correct
13 Correct 20 ms 1500 KB Output is correct
14 Correct 20 ms 1448 KB Output is correct
15 Correct 58 ms 3444 KB Output is correct
16 Correct 59 ms 3576 KB Output is correct
17 Correct 50 ms 3188 KB Output is correct
18 Correct 47 ms 3060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 7 ms 632 KB Output is correct
8 Correct 12 ms 1020 KB Output is correct
9 Correct 22 ms 1596 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 15 ms 1144 KB Output is correct
12 Correct 23 ms 1528 KB Output is correct
13 Correct 20 ms 1500 KB Output is correct
14 Correct 20 ms 1448 KB Output is correct
15 Correct 58 ms 3444 KB Output is correct
16 Correct 59 ms 3576 KB Output is correct
17 Correct 50 ms 3188 KB Output is correct
18 Correct 47 ms 3060 KB Output is correct
19 Correct 61 ms 3572 KB Output is correct
20 Correct 61 ms 3500 KB Output is correct
21 Correct 49 ms 3316 KB Output is correct
22 Correct 49 ms 3124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 7 ms 632 KB Output is correct
8 Correct 12 ms 1020 KB Output is correct
9 Correct 22 ms 1596 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 15 ms 1144 KB Output is correct
12 Correct 23 ms 1528 KB Output is correct
13 Correct 20 ms 1500 KB Output is correct
14 Correct 20 ms 1448 KB Output is correct
15 Correct 58 ms 3444 KB Output is correct
16 Correct 59 ms 3576 KB Output is correct
17 Correct 50 ms 3188 KB Output is correct
18 Correct 47 ms 3060 KB Output is correct
19 Correct 61 ms 3572 KB Output is correct
20 Correct 61 ms 3500 KB Output is correct
21 Correct 49 ms 3316 KB Output is correct
22 Correct 49 ms 3124 KB Output is correct
23 Correct 63 ms 3700 KB Output is correct
24 Correct 65 ms 3696 KB Output is correct
25 Correct 49 ms 3372 KB Output is correct
26 Correct 50 ms 3188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 7 ms 632 KB Output is correct
8 Correct 12 ms 1020 KB Output is correct
9 Correct 22 ms 1596 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 15 ms 1144 KB Output is correct
12 Correct 23 ms 1528 KB Output is correct
13 Correct 20 ms 1500 KB Output is correct
14 Correct 20 ms 1448 KB Output is correct
15 Correct 58 ms 3444 KB Output is correct
16 Correct 59 ms 3576 KB Output is correct
17 Correct 50 ms 3188 KB Output is correct
18 Correct 47 ms 3060 KB Output is correct
19 Correct 61 ms 3572 KB Output is correct
20 Correct 61 ms 3500 KB Output is correct
21 Correct 49 ms 3316 KB Output is correct
22 Correct 49 ms 3124 KB Output is correct
23 Correct 63 ms 3700 KB Output is correct
24 Correct 65 ms 3696 KB Output is correct
25 Correct 49 ms 3372 KB Output is correct
26 Correct 50 ms 3188 KB Output is correct
27 Correct 64 ms 3700 KB Output is correct
28 Correct 64 ms 3700 KB Output is correct
29 Correct 50 ms 3424 KB Output is correct
30 Correct 50 ms 3216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 7 ms 632 KB Output is correct
8 Correct 12 ms 1020 KB Output is correct
9 Correct 22 ms 1596 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 15 ms 1144 KB Output is correct
12 Correct 23 ms 1528 KB Output is correct
13 Correct 20 ms 1500 KB Output is correct
14 Correct 20 ms 1448 KB Output is correct
15 Correct 58 ms 3444 KB Output is correct
16 Correct 59 ms 3576 KB Output is correct
17 Correct 50 ms 3188 KB Output is correct
18 Correct 47 ms 3060 KB Output is correct
19 Correct 61 ms 3572 KB Output is correct
20 Correct 61 ms 3500 KB Output is correct
21 Correct 49 ms 3316 KB Output is correct
22 Correct 49 ms 3124 KB Output is correct
23 Correct 63 ms 3700 KB Output is correct
24 Correct 65 ms 3696 KB Output is correct
25 Correct 49 ms 3372 KB Output is correct
26 Correct 50 ms 3188 KB Output is correct
27 Correct 64 ms 3700 KB Output is correct
28 Correct 64 ms 3700 KB Output is correct
29 Correct 50 ms 3424 KB Output is correct
30 Correct 50 ms 3216 KB Output is correct
31 Correct 65 ms 3728 KB Output is correct
32 Correct 65 ms 3700 KB Output is correct
33 Correct 51 ms 3444 KB Output is correct
34 Correct 52 ms 3316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 7 ms 632 KB Output is correct
8 Correct 12 ms 1020 KB Output is correct
9 Correct 22 ms 1596 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 15 ms 1144 KB Output is correct
12 Correct 23 ms 1528 KB Output is correct
13 Correct 20 ms 1500 KB Output is correct
14 Correct 20 ms 1448 KB Output is correct
15 Correct 58 ms 3444 KB Output is correct
16 Correct 59 ms 3576 KB Output is correct
17 Correct 50 ms 3188 KB Output is correct
18 Correct 47 ms 3060 KB Output is correct
19 Correct 61 ms 3572 KB Output is correct
20 Correct 61 ms 3500 KB Output is correct
21 Correct 49 ms 3316 KB Output is correct
22 Correct 49 ms 3124 KB Output is correct
23 Correct 63 ms 3700 KB Output is correct
24 Correct 65 ms 3696 KB Output is correct
25 Correct 49 ms 3372 KB Output is correct
26 Correct 50 ms 3188 KB Output is correct
27 Correct 64 ms 3700 KB Output is correct
28 Correct 64 ms 3700 KB Output is correct
29 Correct 50 ms 3424 KB Output is correct
30 Correct 50 ms 3216 KB Output is correct
31 Correct 65 ms 3728 KB Output is correct
32 Correct 65 ms 3700 KB Output is correct
33 Correct 51 ms 3444 KB Output is correct
34 Correct 52 ms 3316 KB Output is correct
35 Correct 68 ms 3832 KB Output is correct
36 Correct 68 ms 3824 KB Output is correct
37 Correct 52 ms 3548 KB Output is correct
38 Correct 53 ms 3360 KB Output is correct