Submission #136452

# Submission time Handle Problem Language Result Execution time Memory
136452 2019-07-25T10:26:08 Z onjo0127 Meandian (CEOI06_meandian) C++11
0 / 100
6 ms 380 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);
	Solution(A);
	return 0;
} 
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB number 1 is wrong (0, should be -1)
2 Incorrect 2 ms 252 KB number 1 is wrong (0, should be -1)
3 Incorrect 3 ms 376 KB number 1 is wrong (0, should be 340)
4 Incorrect 3 ms 376 KB number 1 is wrong (0, should be 336)
5 Incorrect 3 ms 380 KB number 1 is wrong (0, should be 1426)
6 Incorrect 3 ms 380 KB number 1 is wrong (0, should be -1)
7 Incorrect 5 ms 376 KB number 1 is wrong (0, should be -1)
8 Incorrect 6 ms 376 KB number 1 is wrong (0, should be 1832)
9 Incorrect 5 ms 248 KB number 1 is wrong (0, should be 444)
10 Incorrect 6 ms 296 KB number 1 is wrong (0, should be 1990)