Submission #138895

#TimeUsernameProblemLanguageResultExecution timeMemory
138895arthurconmyAliens (IOI16_aliens)C++14
0 / 100
4 ms2296 KiB
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "aliens.h" #endif using namespace std; using ll = long long; const int MAXN = 501; ll dp[MAXN][MAXN]; ll take_photos(int n, int m, int k_in_question, vector<int> R, vector<int> C) { for(int i=0; i<MAXN; i++) { for(int j=0; j<MAXN; j++) { dp[i][j]=1e18; } } dp[0][0]=0; for(int i=0; i<n; i++) R[i]=R[i]+1; R.push_back(0); sort(R.begin(),R.end()); for(int i=1; i<=n; i++) { for(int j=1; j<=i; j++) { for(int k=i; k>=1; k--) { dp[i][j] = min(dp[i][j], ll(R[i]-R[k]+1)*ll(R[i]-R[k]+1) + dp[k-1][j-1]); } } } ll ans = 1e18; for(int j=1; j<=k_in_question; j++) { ans = min(ans,dp[n][k_in_question]); } 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...