답안 #731484

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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