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 <iostream>
#include <algorithm>
#include "aliens.h"
using namespace std;
typedef long long int ll;
int N,M,K;
ll DP[1005][1005];
bool B[1005];
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
N=n;
M=m;
K=k;
for(int i=0;i<N;i++)
DP[r[i]][c[i]]=1;
for(ll k=1;k<M;k++)
for(ll i=0;i+k<M;i++){
ll j=i+k;
DP[i][j]=(j-i+1)*(j-i+1);
for(ll p=i;p<j;p++)
DP[i][j]=min(DP[i][j],DP[i][p]+DP[p+1][j]);
}
return DP[0][M-1];
}
/*
2 7 2
1 1
3 3
*/
# | 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... |