Submission #591392

#TimeUsernameProblemLanguageResultExecution timeMemory
591392VanillaAliens (IOI16_aliens)C++17
0 / 100
1 ms1264 KiB
#include <bits/stdc++.h> #include "aliens.h" using namespace std; const int maxn = 5e2 + 2; int dp[maxn][maxn]; // dp[i][j] -> numarul minim de celule pentru a putea fotografia primele j puncte de interes folosind i fotografii long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { // if (k == n) { // int rs = 0; // for (int i = 0; i < n; i++){ // } // } for (int i = 0; i < maxn; i++){ for (int j = 0; j < maxn; j++){ dp[i][j] = 1e8; } } sort(r.begin(), r.end()); for (int i = 0; i < n; i++) dp[1][i] = (r[i] - r[0] + 1) * (r[i] - r[0] + 1); for (int i = 2; i <= k; i++){ for (int j = 1; j < n; j++){ for (int k = j; k > 0; k--){ dp[i][j] = min(dp[i][j], dp[i-1][k-1] + ((r[j] - r[k] + 1) * (r[j] - r[k] + 1))); } } } return dp[k][n-1]; }
#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...