# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103778 | figter001 | Aliens (IOI16_aliens) | C++17 | 111 ms | 3420 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 "aliens.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int nax = 4010;
int dp[nax][nax];
pair<int,int> p[nax];
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
for(int i=1;i<=n;i++)
for(int j=0;j<=k;j++)
dp[j][i] = 1e9;
for(int i=1;i<=n;i++)
p[i] = {r[i-1],c[i-1]};
sort(p+1,p+n+1);
dp[0][0] = 0;
for(int u=1;u<=k;u++){
for(int i=1;i<=n;i++){
int x = p[i].first;
int y = p[i].second;
for(int l=1;l<=i;l++){
int sz = (x - p[l].first + 1) * (x - p[l].first + 1);
dp[u][i] = min(dp[u][i],dp[u-1][l-1] + sz);
}
}
}
return dp[k][n];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |