#include <bits/stdc++.h>
#include "aliens.h"
using namespace std;
#define ll long long
#define vl vector<ll>
#define all(aaa) aaa.begin(), aaa.end()
#define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++)
#define vb vector<bool>
#define ed "\n"
#define pb push_back
#define pll pair<ll, ll>
#define fi first
#define se second
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c){
vl arr;
set<ll> st;
ff(i, 0, n){
st.insert(r[i]);
}
for(auto &p : st){
arr.pb(p);
}
ll sz = arr.size();
vector<vl> dp(sz+1, vl(k+1, 1e15));
ff(j, 0, k+1){
dp[0][j] = 0;
}
ff(i, 1, sz+1){
ff(j, 1, k+1){
ff(id, 0, i){
ll cost = (arr[i-1]-arr[id]+1)*(arr[i-1]-arr[id]+1);
dp[i][j] = min(dp[i][j], dp[id][j-1]+cost);
}
}
}
return dp[n][k];
}
/*
int main() {
int n, m, k;
assert(3 == scanf("%d %d %d", &n, &m, &k));
std::vector<int> r(n), c(n);
for (int i = 0; i < n; i++) {
assert(2 == scanf("%d %d", &r[i], &c[i]));
}
long long ans = take_photos(n, m, k, r, c);
printf("%lld\n", ans);
return 0;
}
*/
Compilation message (stderr)
aliens.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
aliens_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | 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... |