Submission #136452

#TimeUsernameProblemLanguageResultExecution timeMemory
136452onjo0127Meandian (CEOI06_meandian)C++11
0 / 100
6 ms380 KiB
#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 timeMemoryGrader output
Fetching results...