제출 #749484

#제출 시각아이디문제언어결과실행 시간메모리
749484Desh03Aliens (IOI16_aliens)C++17
0 / 100
1 ms212 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, vector<int> r, vector<int> c) { r.erase(unique(r.begin(), r.end()), r.end()); n = r.size(); vector<vector<long long>> dp(k, vector<long long> (n, INF)); for (int i = 0; i < n; i++) dp[0][i] = (long long) (r[i] - r[0] + 1) * (r[i] - r[0] + 1); for (int j = 1; j < k; j++) for (int i = j; i < n; i++) for (int k = 0; k < i; k++) dp[j][i] = min(dp[j][i], dp[j - 1][k] + (long long) (r[i] - r[k + 1] + 1) * (r[i] - r[k + 1] + 1)); long long ans = INF; for (int i = 0; i < k; i++) ans = min(ans, dp[i][n - 1]); return ans; }
#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...