# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136458 | onjo0127 | Meandian (CEOI06_meandian) | C++11 | 9 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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] = -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]-1] = ans; S.erase(S.begin() + 0);}
if(a1 == v1) {A[S[1]-1] = ans; S.erase(S.begin() + 1);}
if(a2 == v1) {A[S[2]-1] = ans; S.erase(S.begin() + 2);}
if(a3 == v1) {A[S[3]-1] = ans; S.erase(S.begin() + 3);}
if(a4 == v1) {A[S[4]-1] = 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 |
---|---|---|---|---|
Fetching results... |