Submission #69179

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
691792018-08-20 08:40:08mr_bananaAliens (IOI16_aliens)C++17
12 / 100
248 ms2592 KiB
#include "aliens.h"
#include<bits/stdc++.h>
using namespace std;
const int MN=500+10;
const long long inf=1e13;
long long dp[MN][MN];
pair<int,int> p[MN];
long long sq(int x){
return 1ll*x*x;
}
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
for(int i=0;i<n;i++){
p[i]={min(r[i],c[i]),-max(r[i],c[i])-1};
}
sort(p,p+n);
int n1=unique(p,p+n)-p;
n=0;
int mx=-1;
for(int i=0;i<n1;i++){
if(mx<-p[i].second){
p[n++]={p[i].first,-p[i].second};
mx=p[i].second;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<=k;j++){
dp[i+1][j]=inf;
for(int l=0;l<=i;l++){
if(j){
dp[i+1][j]=min(dp[i+1][j],sq(p[i].second-p[l].first)+dp[l][j-1]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...