记录编号 |
311353 |
评测结果 |
AAAAAAAAAA |
题目名称 |
出题 |
最终得分 |
100 |
用户昵称 |
Janis |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.068 s |
提交时间 |
2016-09-24 11:54:01 |
内存使用 |
7.84 MiB |
显示代码纯文本
var
i,j,n,m,low,high,ans:longint;
s,w,sums,sumw:array[0..1000]of int64;
dp:array[0..1000,0..1000]of int64;
begin
assign(input,'prob.in');reset(input);
assign(output,'prob.out');rewrite(output);
readln(n,low,high);
for i:=1 to n do
begin
read(s[i]);
sums[i]:=sums[i-1]+s[i];
end;
for i:=1 to n do
begin
read(w[i]);
sumw[i]:=sumw[i-1]+w[i];
end;
for i:=1 to n do
for j:=i to n do
begin
dp[i,j]:=dp[i-1,j];
if dp[i,j-1]>dp[i,j] then dp[i,j]:=dp[i,j-1];
if (dp[i,j]<dp[i-1,j-1]+sumw[j]-sumw[i-1])and(sums[j]-sums[i-1]>=low)and(sums[j]-sums[i-1]<=high) then
dp[i,j]:=dp[i-1,j-1]+sumw[j]-sumw[i-1];
end;
writeln(dp[n,n]);
close(input);close(output);
end.