Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 百练过了，这里提交什么都是超时？

Posted by csucyj at 2018-08-24 18:36:47 on Problem 2355
```#include<iostream>
#include<vector>
#include<list>
#include<stack>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<sstream>
#include<map>
using namespace std;
#define N 10005
#define Inf 99999999
#define inf  -9999999
int dp[N];
int num[N] ={0};
int main(){
int l1,l2,l3,c1,c2,c3;
cin>>l1>>l2>>l3>>c1>>c2>>c3;
int n;
cin>>n;
int beg,end;
cin>>beg>>end;
if(beg>end){
int k =beg;
beg =end;
end =k;
}

for(int i=beg;i<=end;i++){
dp[i] =0x7fffffff;
}

num[1] = 0;
for(int i=2;i<=n;i++){
cin>>num[i];
}
dp[beg] = 0;
for(int i=beg;i<end;i++){
for(int j=i+1;j<=end;j++){
int k =num[j]-num[i];
if(k<=l1&& dp[j] > dp[i] + c1){
dp[j] = min(dp[j],dp[i]+c1) ;

}
if(k<=l2&& dp[j] > dp[i] + c2){
dp[j] = min(dp[j],dp[i]+c2) ;

}
if(k<=l3&& dp[j] > dp[i] +c3){
dp[j] = min(dp[j],dp[i]+c3) ;

}
}

}
cout<<dp[end]<<endl;

return 0;
}```

Followed by: