제출 #432195

#제출 시각아이디문제언어결과실행 시간메모리
432195Pichon5Aliens (IOI16_aliens)C++17
0 / 100
1 ms2252 KiB
#include "aliens.h" #include <bits/stdc++.h> #define pb push_back #define F first #define S second #define vi vector<int> #define vll vector<ll> #define ll long long using namespace std; const int tam=505; int N; ll dp[tam][tam]; vi v; ll f(int pos, int k){ if(pos>=N)return 0; if(k==0)return 1e9; if(dp[pos][k]!=-1)return dp[pos][k]; dp[pos][k]=1e16; for(int i=pos+1;i<N;i++){ ll tam=v[i]-v[pos]+1; dp[pos][k]=min(dp[pos][k],tam*tam+f(i+1,k-1)); } return dp[pos][k]; } long long take_photos(int n, int m, int k,vi r,vi c){ N=n; v=r; memset(dp,-1,sizeof(dp)); return f(0,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...