제출 #169092

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1690922019-12-18 11:20:20mohammad_kilaniAliens (IOI16_aliens)C++17
25 / 100
2075 ms126456 KiB
#include <bits/stdc++.h>
#include "aliens.h"
using namespace std;
const int N = 4010 , K = 4010;
vector< pair<int,int> > arr , tmp;
long long dp[N][K];
int n , m , k;
long long solve(int i,int cur){
if(i == n)
return 0;
if(cur == k)
return (long long)1e18;
if(dp[i][cur] != -1)
return dp[i][cur];
dp[i][cur] = (long long)1e18;
int mx = -1;
long long val;
for(int j = i ;j < n;j++){
mx = max(mx,arr[j].second);
val = (long long)(mx - arr[i].first + 1) * (long long)(mx - arr[i].first + 1);
if(j < n - 1 && mx >= arr[j + 1].first){
val -= (long long)(mx - arr[j + 1].first + 1) * (long long)(mx - arr[j + 1].first + 1);
}
dp[i][cur] = min(dp[i][cur] , val + solve(j + 1, cur + 1));
}
return dp[i][cur];
}
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...