답안 #136362

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
136362 2019-07-25T07:51:36 Z khsoo01 Meandian (CEOI06_meandian) C++11
100 / 100
8 ms 380 KB
#include<bits/stdc++.h>
#include"libmean.h"
#define X first
#define Y second
using namespace std;
 
typedef pair<int,int> pii;
 
int n, ans[105];
 
void solve (vector<int> V) {
	vector<pii> R;
	for(int i=0;i<5;i++) {
		vector<int> T;
		for(int j=0;j<5;j++) {
			if(i != j) T.push_back(V[j]);
		}
		R.push_back({Meandian(T[0], T[1], T[2], T[3]), V[i]});
	}
	sort(R.begin(), R.end());
	ans[R[2].Y-1] = R[0].X - R[2].X + R[4].X;
}
 
int main()
{
	n = Init();
	for(int i=0;i<n;i++) {
		ans[i] = -1;
	}
	if(n == 4) {
		Solution(ans);
		return 0;
	}
	int C = 0;
	while(C < n-4) {
		vector<int> V;
		for(int i=1;V.size()<5&&i<=n;i++) {
			if(ans[i-1] == -1) V.push_back(i);
		}
		solve(V);
		C++;
	}
	Solution(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 248 KB Output is correct
5 Correct 3 ms 248 KB Output is correct
6 Correct 5 ms 380 KB Output is correct
7 Correct 5 ms 248 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 5 ms 248 KB Output is correct
10 Correct 8 ms 376 KB Output is correct