답안 #120633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
120633 2019-06-25T06:30:43 Z 김세빈(#2958) Minerals (JOI19_minerals) C++14
75 / 100
43 ms 2724 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]);
		if(f) query(X[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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 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 9 ms 640 KB Output is correct
5 Correct 15 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 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 9 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 896 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 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 9 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 896 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
15 Correct 41 ms 2604 KB Output is correct
16 Correct 41 ms 2620 KB Output is correct
17 Correct 32 ms 2632 KB Output is correct
18 Correct 32 ms 2456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 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 9 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 896 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
15 Correct 41 ms 2604 KB Output is correct
16 Correct 41 ms 2620 KB Output is correct
17 Correct 32 ms 2632 KB Output is correct
18 Correct 32 ms 2456 KB Output is correct
19 Correct 43 ms 2724 KB Output is correct
20 Correct 42 ms 2656 KB Output is correct
21 Correct 31 ms 2584 KB Output is correct
22 Correct 31 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 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 9 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 896 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
15 Correct 41 ms 2604 KB Output is correct
16 Correct 41 ms 2620 KB Output is correct
17 Correct 32 ms 2632 KB Output is correct
18 Correct 32 ms 2456 KB Output is correct
19 Correct 43 ms 2724 KB Output is correct
20 Correct 42 ms 2656 KB Output is correct
21 Correct 31 ms 2584 KB Output is correct
22 Correct 31 ms 2392 KB Output is correct
23 Incorrect 43 ms 2692 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 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 9 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 896 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
15 Correct 41 ms 2604 KB Output is correct
16 Correct 41 ms 2620 KB Output is correct
17 Correct 32 ms 2632 KB Output is correct
18 Correct 32 ms 2456 KB Output is correct
19 Correct 43 ms 2724 KB Output is correct
20 Correct 42 ms 2656 KB Output is correct
21 Correct 31 ms 2584 KB Output is correct
22 Correct 31 ms 2392 KB Output is correct
23 Incorrect 43 ms 2692 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 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 9 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 896 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
15 Correct 41 ms 2604 KB Output is correct
16 Correct 41 ms 2620 KB Output is correct
17 Correct 32 ms 2632 KB Output is correct
18 Correct 32 ms 2456 KB Output is correct
19 Correct 43 ms 2724 KB Output is correct
20 Correct 42 ms 2656 KB Output is correct
21 Correct 31 ms 2584 KB Output is correct
22 Correct 31 ms 2392 KB Output is correct
23 Incorrect 43 ms 2692 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 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 9 ms 640 KB Output is correct
9 Correct 15 ms 1024 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 896 KB Output is correct
12 Correct 15 ms 1152 KB Output is correct
13 Correct 13 ms 1152 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
15 Correct 41 ms 2604 KB Output is correct
16 Correct 41 ms 2620 KB Output is correct
17 Correct 32 ms 2632 KB Output is correct
18 Correct 32 ms 2456 KB Output is correct
19 Correct 43 ms 2724 KB Output is correct
20 Correct 42 ms 2656 KB Output is correct
21 Correct 31 ms 2584 KB Output is correct
22 Correct 31 ms 2392 KB Output is correct
23 Incorrect 43 ms 2692 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -