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