Submission #731484

# Submission time Handle Problem Language Result Execution time Memory
731484 2023-04-27T13:22:02 Z Trunkty Meandian (CEOI06_meandian) C++14
100 / 100
4 ms 208 KB
#include <bits/extc++.h>
using namespace std;
typedef long long ll;
//#define int ll

#include "libmean.h"

int n;
int arr[105];
set<int> s;

signed main(){
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
    n = Init();
    for(int i=0;i<n;i++){
        arr[i] = -1;
    }
    for(int i=1;i<=4;i++){
        s.insert(i);
    }
    for(int i=5;i<=n;i++){
        s.insert(i);
        vector<vector<int>> v;
        for(int j:s){
            vector<int> p;
            for(int k:s){
                if(j!=k){
                    p.push_back(k);
                }
            }
            v.push_back({Meandian(p[0],p[1],p[2],p[3]),j});
        }
        sort(v.begin(),v.end());
        arr[v[2][1]-1] = v[0][0]+v[4][0]-v[2][0];
        s.erase(v[2][1]);
    }
    Solution(arr);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 3 ms 208 KB Output is correct
8 Correct 4 ms 208 KB Output is correct
9 Correct 4 ms 208 KB Output is correct
10 Correct 4 ms 208 KB Output is correct