/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 1ms 256.0 KiB
#2 Accepted 1ms 256.0 KiB
#3 Accepted 1ms 256.0 KiB
#4 Accepted 3ms 256.0 KiB
#5 Accepted 15ms 504.0 KiB
#6 Accepted 25ms 884.0 KiB
#7 Accepted 41ms 1.25 MiB
#8 Accepted 54ms 1.664 MiB
#9 Accepted 63ms 2.098 MiB
#10 Accepted 54ms 3.828 MiB

代码

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.

信息

递交者
类型
递交
题目
【模板】最大子序和
题目数据
下载
语言
Pascal
递交时间
2017-08-22 22:04:10
评测时间
2017-08-22 22:04:10
评测机
分数
100
总耗时
263ms
峰值内存
3.828 MiB