Submission #555587

#TimeUsernameProblemLanguageResultExecution timeMemory
555587fuad27Aliens (IOI16_aliens)C++17
12 / 100
150 ms2260 KiB
#include "aliens.h" #include<bits/stdc++.h> using namespace std; const long long INF = 1e18; long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> C) { long long dp[n+1][k+1]; sort(r.begin(), r.end()); for(int i = 1;i<=n;i++) dp[i][0] = INF; for(int i = 0;i<=k;i++) { dp[0][i] = 0; } for(int i = 1;i<=n;i++) { for(int j = 1;j<=k;j++) { dp[i][j] = INF; for(int c = 1;c<=i;c++) { dp[i][j] = min(dp[i][j], dp[c-1][j-1]+(r[i-1]-r[c-1]+1)*(r[i-1] - r[c-1]+1)); } } } return dp[n][k]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...