Submission #120634

# Submission time Handle Problem Language Result Execution time Memory
120634 2019-06-25T06:32:31 Z 김세빈(#2958) Minerals (JOI19_minerals) C++14
80 / 100
61 ms 2840 KB
#include <bits/stdc++.h>

#include "minerals.h"

using namespace std;

bool chk[101010];
int pv, nx;

int query(int x)
{
	nx = Query(x);
	if(pv != nx){
		pv = nx;
		return 1;
	}
	return 0;
}

void dnc(vector <int> &X, vector <int> &Y, bool f)
{
	if(X.size() == 1){
		Answer(X[0], Y[0]);
		return;
	}
	
	vector <int> XL, XR, YL, YR;
	int n, m, i;
	
	n = X.size(); m = n / 2;
	
	for(i=0; i<m; i++){
		XL.push_back(X[i]);
		if(!f) query(X[i]);
	}
	
	for(; i<n; i++){
		XR.push_back(X[i]);
		if(f) query(X[i]);
	}
	
	for(i=0; i<n; i++){
		if(query(Y[i])) YR.push_back(Y[i]);
		else YL.push_back(Y[i]);
	}
	
	dnc(XL, YL, 1); dnc(XR, YR, 0);
}

void Solve(int n)
{
	vector <int> X, Y;
	int i;
	
	for(i=1; i<=n+n; i++){
		if(query(i)) X.push_back(i);
		else Y.push_back(i);
	}
	
	dnc(X, Y, 1);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 8 ms 640 KB Output is correct
5 Correct 15 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 11 ms 944 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 13 ms 1072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 11 ms 944 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 13 ms 1072 KB Output is correct
15 Correct 48 ms 2684 KB Output is correct
16 Correct 42 ms 2592 KB Output is correct
17 Correct 61 ms 2456 KB Output is correct
18 Correct 31 ms 2560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 11 ms 944 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 13 ms 1072 KB Output is correct
15 Correct 48 ms 2684 KB Output is correct
16 Correct 42 ms 2592 KB Output is correct
17 Correct 61 ms 2456 KB Output is correct
18 Correct 31 ms 2560 KB Output is correct
19 Correct 44 ms 2656 KB Output is correct
20 Correct 46 ms 2688 KB Output is correct
21 Correct 31 ms 2616 KB Output is correct
22 Correct 36 ms 2456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 11 ms 944 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 13 ms 1072 KB Output is correct
15 Correct 48 ms 2684 KB Output is correct
16 Correct 42 ms 2592 KB Output is correct
17 Correct 61 ms 2456 KB Output is correct
18 Correct 31 ms 2560 KB Output is correct
19 Correct 44 ms 2656 KB Output is correct
20 Correct 46 ms 2688 KB Output is correct
21 Correct 31 ms 2616 KB Output is correct
22 Correct 36 ms 2456 KB Output is correct
23 Correct 48 ms 2784 KB Output is correct
24 Correct 45 ms 2812 KB Output is correct
25 Correct 33 ms 2604 KB Output is correct
26 Correct 32 ms 2452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 11 ms 944 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 13 ms 1072 KB Output is correct
15 Correct 48 ms 2684 KB Output is correct
16 Correct 42 ms 2592 KB Output is correct
17 Correct 61 ms 2456 KB Output is correct
18 Correct 31 ms 2560 KB Output is correct
19 Correct 44 ms 2656 KB Output is correct
20 Correct 46 ms 2688 KB Output is correct
21 Correct 31 ms 2616 KB Output is correct
22 Correct 36 ms 2456 KB Output is correct
23 Correct 48 ms 2784 KB Output is correct
24 Correct 45 ms 2812 KB Output is correct
25 Correct 33 ms 2604 KB Output is correct
26 Correct 32 ms 2452 KB Output is correct
27 Incorrect 43 ms 2840 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 11 ms 944 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 13 ms 1072 KB Output is correct
15 Correct 48 ms 2684 KB Output is correct
16 Correct 42 ms 2592 KB Output is correct
17 Correct 61 ms 2456 KB Output is correct
18 Correct 31 ms 2560 KB Output is correct
19 Correct 44 ms 2656 KB Output is correct
20 Correct 46 ms 2688 KB Output is correct
21 Correct 31 ms 2616 KB Output is correct
22 Correct 36 ms 2456 KB Output is correct
23 Correct 48 ms 2784 KB Output is correct
24 Correct 45 ms 2812 KB Output is correct
25 Correct 33 ms 2604 KB Output is correct
26 Correct 32 ms 2452 KB Output is correct
27 Incorrect 43 ms 2840 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 304 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 11 ms 944 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 13 ms 1072 KB Output is correct
15 Correct 48 ms 2684 KB Output is correct
16 Correct 42 ms 2592 KB Output is correct
17 Correct 61 ms 2456 KB Output is correct
18 Correct 31 ms 2560 KB Output is correct
19 Correct 44 ms 2656 KB Output is correct
20 Correct 46 ms 2688 KB Output is correct
21 Correct 31 ms 2616 KB Output is correct
22 Correct 36 ms 2456 KB Output is correct
23 Correct 48 ms 2784 KB Output is correct
24 Correct 45 ms 2812 KB Output is correct
25 Correct 33 ms 2604 KB Output is correct
26 Correct 32 ms 2452 KB Output is correct
27 Incorrect 43 ms 2840 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -