답안 #136450

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
136450 2019-07-25T10:25:44 Z onjo0127 Meandian (CEOI06_meandian) C++11
0 / 100
8 ms 504 KB
#include "libmean.h"
#include <bits/stdc++.h>
using namespace std;

int N, A[111];

void solve(vector<int> &S) {
	if((int)S.size() == 4) {
		for(auto& it: S) A[it] = -1;
		return;
	}
	int a0 = Meandian(S[1], S[2], S[3], S[4]);
	int a1 = Meandian(S[0], S[2], S[3], S[4]);
	int a2 = Meandian(S[0], S[1], S[3], S[4]);
	int a3 = Meandian(S[0], S[1], S[2], S[4]);
	int a4 = Meandian(S[0], S[1], S[2], S[3]);
	int v1 = a0 ^ a1 ^ a2 ^ a3 ^ a4;
	int v2 = a0 + a1 + a2 + a3 + a4 - v1;
	int ans = (2*v1 + v2) / 2 - 2*v1;
	if(a0 == v1) {A[S[0]] = ans; S.erase(S.begin() + 0);}
	if(a1 == v1) {A[S[1]] = ans; S.erase(S.begin() + 1);}
	if(a2 == v1) {A[S[2]] = ans; S.erase(S.begin() + 2);}
	if(a3 == v1) {A[S[3]] = ans; S.erase(S.begin() + 3);}
	if(a4 == v1) {A[S[4]] = ans; S.erase(S.begin() + 4);}
	solve(S);
}

int main() {
	N = Init();
	vector<int> S;
	for(int i=1; i<=N; i++) S.push_back(i);
	solve(S);
	for(int i=1; i<=N; i++) printf("%d ", A[i]);
	puts("");
	Solution(A);
	return 0;
} 
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Invalid query
2 Incorrect 2 ms 376 KB Invalid query
3 Incorrect 3 ms 248 KB Invalid query
4 Incorrect 3 ms 248 KB Invalid query
5 Incorrect 3 ms 376 KB Invalid query
6 Incorrect 3 ms 376 KB Invalid query
7 Incorrect 6 ms 504 KB Invalid query
8 Incorrect 4 ms 248 KB Invalid query
9 Incorrect 8 ms 376 KB Invalid query
10 Incorrect 6 ms 380 KB Invalid query