제출 #65270

#제출 시각아이디문제언어결과실행 시간메모리
65270FedericoSAliens (IOI16_aliens)C++14
0 / 100
3 ms636 KiB
#include <iostream> #include <algorithm> #include "aliens.h" using namespace std; typedef long long int ll; int N,M,K; ll DP[1005][1005]; ll R[1005]; long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) { N=n; M=m; K=k; for(int i=0;i<N;i++) R[i+1]=r[i]; for(int i=0;i<=N;i++) for(int k=0;k<=K;k++) DP[i][k]=1e18; DP[0][0]=0; for(int i=1;i<=N;i++) for(int k=1;k<=K;k++){ DP[i][k]=DP[i][k-1]; for(int j=0;j<i;j++) DP[i][k]=min(DP[i][k],DP[j][k-1]+(R[i]-R[j+1]+1)*(R[i]-R[j+1]+1)); } //for(int i=1;i<=N;i++)for(int k=1;k<=K;k++)cout<<i<<" "<<k<<" "<<DP[i][k]<<endl; return DP[N][K]; } /* 2 7 1 1 1 3 3 */
#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...