Submission #592782

#TimeUsernameProblemLanguageResultExecution timeMemory
592782PiejanVDCAliens (IOI16_aliens)C++17
12 / 100
126 ms2280 KiB
#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][k+5]; dp[0][0] = 0; sort(r.begin(), r.end()); for(int i = 1 ; i <= n ; i++) { for(int j = 0 ; j <= k ; j++) dp[i][j] = LLONG_MAX; for(int ii = 0 ; ii < i ; ii++) { for(int jj = 1 ; jj <= k ; jj++) if(dp[ii][jj-1] != LLONG_MAX) dp[i][jj] = min(dp[i][jj], dp[ii][jj-1] + (long long) (r[i-1] - r[ii] + 1) * (r[i-1] - r[ii] + 1)); } } long long mn = LLONG_MAX; for(int i = 0 ; i <= k ; i++) mn = min(mn, dp[n][i]); return mn; }
#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...