제출 #617730

#제출 시각아이디문제언어결과실행 시간메모리
617730A_DAliens (IOI16_aliens)C++14
12 / 100
151 ms2296 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; const int N=5e2+11; long long dp[N][N]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { // for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ dp[0][j]=1e18; dp[j][0]=1e18; } // } sort(r.begin(),r.end()); for(int i=1;i<=n;i++){ for(int j=1;j<=k;j++){ long long ret=1e18; for(int h=i;h>=1;h--){ // cout<<"val "<<i<<" "<<h<<" "<<j<<"\n"; if(dp[h-1][j-1]==1e18)continue; long long u=(r[i-1]-r[h-1]+1)*(r[i-1]-r[h-1]+1)+dp[h-1][j-1]; // cout<<r[i-1]<<" "<<r[h-1]<<" "<<u<<"\n"; ret=min(ret,u); } dp[i][j]=ret; } } // cout<<dp[0][0]<<" "<<dp[1][1]<<"\n"; long long ret=1e18; for(int i=1;i<=k;i++){ ret=min(ret,dp[n][i]); } return ret; }
#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...