답안 #120678

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
120678 2019-06-25T07:56:45 Z 임유진(#2961) Minerals (JOI19_minerals) C++14
40 / 100
43 ms 3296 KB
#include "minerals.h"
#include<vector>

using namespace std;

#define MAXN 43005

int q[MAXN];
vector<int> L, R;

vector<int> f(vector<int> lidx, int rs, int re, bool in){
	//printf("[%d %d]", rs, re);
	//for(auto a:lidx) printf("%d ", a);
	//printf("\n");
	if(rs==re) return lidx;
	int m=(rs+re)/2;
	vector<int> q(re-rs+2), lef, rig;
	for(int i=m+1; i<=re; i++) q[re-rs+1]=Query(R[i]);
	for(int i=re-rs; i>=0; i--){
		q[i]=Query(L[lidx[i]]);
		if(in==true){
			if(q[i]!=q[i+1]) rig.push_back(lidx[i]);
			else lef.push_back(lidx[i]);
		}
		else{
			if(q[i]!=q[i+1]) lef.push_back(lidx[i]);
			else rig.push_back(lidx[i]);
		}
	}
	vector<int> v1, v2;
	v1=f(lef, rs, m, in);
	v2=f(rig, m+1, re, !in);
	for(auto a:v2) v1.push_back(a);
	return v1;
}

void Solve(int N) {
	for(int i=1; i<=2*N; i++){
		q[i]=Query(i);
		if(q[i]>q[i-1]) L.push_back(i);
		else R.push_back(i);
	}
	//for(auto a:L) printf("%d ", a);
	//printf("\n");
	vector<int> v(N);
	for(int i=0; i<N; i++) v[i]=i;
	vector<int> ans=f(v, 0, N-1, true);
	//for(auto a:ans) printf("{%d}", a);
	for(int i=0; i<N; i++) Answer(L[ans[i]], R[i]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 9 ms 860 KB Output is correct
5 Correct 16 ms 1376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 9 ms 860 KB Output is correct
9 Correct 16 ms 1376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 1152 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 12 ms 1520 KB Output is correct
14 Correct 13 ms 1512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 9 ms 860 KB Output is correct
9 Correct 16 ms 1376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 1152 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 12 ms 1520 KB Output is correct
14 Correct 13 ms 1512 KB Output is correct
15 Incorrect 43 ms 3296 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 9 ms 860 KB Output is correct
9 Correct 16 ms 1376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 1152 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 12 ms 1520 KB Output is correct
14 Correct 13 ms 1512 KB Output is correct
15 Incorrect 43 ms 3296 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 9 ms 860 KB Output is correct
9 Correct 16 ms 1376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 1152 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 12 ms 1520 KB Output is correct
14 Correct 13 ms 1512 KB Output is correct
15 Incorrect 43 ms 3296 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 9 ms 860 KB Output is correct
9 Correct 16 ms 1376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 1152 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 12 ms 1520 KB Output is correct
14 Correct 13 ms 1512 KB Output is correct
15 Incorrect 43 ms 3296 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 9 ms 860 KB Output is correct
9 Correct 16 ms 1376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 1152 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 12 ms 1520 KB Output is correct
14 Correct 13 ms 1512 KB Output is correct
15 Incorrect 43 ms 3296 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 384 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 9 ms 860 KB Output is correct
9 Correct 16 ms 1376 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 11 ms 1152 KB Output is correct
12 Correct 16 ms 1536 KB Output is correct
13 Correct 12 ms 1520 KB Output is correct
14 Correct 13 ms 1512 KB Output is correct
15 Incorrect 43 ms 3296 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -