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>
#ifdef EVAL
#else
#include"grader.cpp"
#endif
using namespace std;
typedef long long ll;
ll dp[505][505];
ll sq(ll a){
return a*a;
}
ll take_photos(int n,int m,int k,vector<int>r,vector<int>c){
r.push_back(-2e9);
sort(r.begin(),r.end());
for(int i=0;i<505;i++)
for(int j=0;j<505;j++)dp[i][j]=2e9;
dp[0][0]=0;
for(int i=1;i<=k;i++)
for(int j=1;j<=n;j++)
for(int l=1;l<=j;l++)dp[j][i]=min(dp[j][i],dp[l-1][i-1]+sq(r[j]-r[l]+1));
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... |