Submission #136362

#TimeUsernameProblemLanguageResultExecution timeMemory
136362khsoo01Meandian (CEOI06_meandian)C++11
100 / 100
8 ms380 KiB
#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); }
#Verdict Execution timeMemoryGrader output
Fetching results...