제출 #138897

#제출 시각아이디문제언어결과실행 시간메모리
138897arthurconmyAliens (IOI16_aliens)C++14
12 / 100
118 ms2368 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++) // covering the first i things { for(int j=1; j<=i; j++) // with j intervals { for(int k=i; k>=1; k--) // the last thing considered was k (so k--i square) { dp[i][j] = min(dp[i][j], ll(R[i]-R[k]+1)*ll(R[i]-R[k]+1) + dp[k-1][j-1]); } // cout << i << " " << j << " " << dp[i][j] << endl; } } ll ans = 1e18; for(int j=1; j<=k_in_question; j++) { ans = min(ans,dp[n][j]); } return ans; } #ifdef ARTHUR_LOCAL int main() { vector<int> V = {1,2}; cout << take_photos(2,10,1,V,V) << endl; } #endif
#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...