Accepted
/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
代码
var l,r,a,b,n,i,t,max:longint;
s,q:array[0..500000]of longint;
begin
readln(n,a,b);
s[0]:=0;
for i:=1 to n do begin
read(t);
s[i]:=s[i-1]+t;
end;
l:=0; r:=-1;
max:=-maxlongint;
for i:=a to n do begin
if (l<=r)and(i-q[l]>b) then inc(l);
while (l<=r)and(s[i-a]-s[q[r]]<=0) do dec(r);
inc(r); q[r]:=i-a;
if s[i]-s[q[l]]>max then max:=s[i]-s[q[l]];
end;
writeln(max);
close(input);
close(output);
end.