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;
const int N=5e2+11;
int dp[N][N];
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
sort(r.begin(),r.end());
for(int i=1;i<=n;i++){
for(int j=1;j<=k;j++){
long long ret=1e18;
for(int h=i;h>=1;h--){
long long u=(r[i-1]-r[h-1]+1)*(r[i-1]-r[h-1]+1)+dp[h-1][k-1];
// cout<<r[i-1]<<" "<<r[h-1]<<" "<<u<<"\n";
ret=min(ret,u);
}
dp[i][j]=ret;
}
}
// cout<<dp[0][0]<<" "<<dp[1][1]<<"\n";
return dp[n][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... |