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 int ll;
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
vector<vector<long long>> dp(n+1, vector<long long> (k+1, n*n+10));
for(ll i=0; i<n; i++){
r[i]++;
}
sort(r.begin(), r.end());
for(ll i: r){
dp[i][1]=(i-r[0]+1)*(i-r[0]+1);
}
for(ll i: r){
for(ll j=1; j<=k; j++){
dp[i][j]=min(dp[i][j-1], dp[i][j]);
for(ll h: r){
if(h>i) break;
dp[i][j]=min(dp[i][j], dp[h-1][j-1]+(i-h+1)*(i-h+1));
}
}
}
return dp[r[n-1]][k];
}
# | 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... |