| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 162027 | Leonardo_Paes | Cover (COCI18_cover) | C++17 | 65 ms | 404 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
const int maxn = 5e3+10;
const long long inf = 2e18+10;
typedef pair<int,int> pii;
pii points[maxn], useful_points[maxn];
int n;
long long dp[maxn];
bool mark[maxn];
int main(){
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> points[i].x >> points[i].y;
        points[i].x = abs(points[i].x);
        points[i].y = abs(points[i].y);
    }
    sort(points+1, points+n+1);
    int id = 0;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            if(!mark[j] and i!=j and points[i].x >= points[j].x and points[i].y >= points[j].y){
                mark[j] = 1;
            }
        }
    }
    for(int i=1; i<=n; i++){
        if(!mark[i]) useful_points[++id] = points[i];
    }
    for(int i=1; i<=id; i++) dp[i] = inf;
    dp[0] = 0;
    for(int i=1; i<=id; i++){
        for(int j=1; j<=id; j++){
            dp[i] = min(dp[i], dp[j-1] + 4LL*(useful_points[i].x)*(useful_points[j].y));
        }
    }
    cout << dp[id] << endl;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
