Submission #555712

#TimeUsernameProblemLanguageResultExecution timeMemory
555712FidanAliens (IOI16_aliens)C++17
0 / 100
1 ms340 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; typedef int ll; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { vector<vector<long long>> dp(n+1, vector<long long> (k+1, n*n+10)); for(ll i=0; i<n; i++){ r[i]++; } sort(r.begin(), r.end()); for(ll i: r){ dp[i][1]=(i-r[0]+1)*(i-r[0]+1); } for(ll i: r){ for(ll j=1; j<=k; j++){ dp[i][j]=min(dp[i][j-1], dp[i][j]); for(ll h: r){ if(h>i) break; dp[i][j]=min(dp[i][j], dp[h-1][j-1]+(i-h+1)*(i-h+1)); } } } return dp[r[n-1]][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...