제출 #128299

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1282992019-07-10 16:18:16zeyad49선물상자 (IOI15_boxes)C++17
10 / 100
1836 ms4472 KiB
#include <bits/stdc++.h>
using namespace std;
const int N=1000;
const long long INF=(long)1e18;
int K,L;
int memo[N][N];
int teams[N];
long long dist[N][N];
long long dp(int l,int r) {
if(l>r)
return 0;
if(memo[l][r]!=-1)
return memo[l][r];
long long ans=INF;
if(r-l+1<=K && K>1)
ans=L;
for(int k=l;k<=r;k++){
if(k-l+1>K) break;
ans=min(ans,teams[k]+dp(k+1,r)+min(teams[k],L-teams[k]));
}
for(int k=r;k>=l;k--){
if(r-k+1>K)
break;
ans=min(ans,L-teams[k]+dp(l,k-1)+min(L-teams[k],teams[k]));
}
return memo[l][r]=ans;
}
long long delivery(int a, int b, int c, int x[]) {
K=b;
L=c;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp: In function 'long long int dp(int, int)':
boxes.cpp:26:21: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   return memo[l][r]=ans;
                     ^~~
#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...