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;
ll sq(ll a) {return a * a;}
ll take_photos(int n, int m, int k, vector<int> r, vector<int> c){
sort(r.begin(), r.end());
vector<ll> dp1(n, 1e15), dp2(n);
while (k--){
for (int i=0; i<n; i++){
dp2[i] = dp1[i];
for (int j=0; j<=i; j++){
dp2[i] = min(dp2[i], (j ? dp1[j-1] : 0) + sq(r[i] - r[j] + 1));
}
}
swap(dp1, dp2);
}
return dp2.back();
}
# | 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... |