Pagini recente » Cod sursa (job #1570972) | Cod sursa (job #1882332) | Cod sursa (job #1578313) | Cod sursa (job #2024735) | Cod sursa (job #1845552)
program jgash;
var f,g:text;
i,n,max,pi,pf,nr,p,best:longint;
bufin,bufout:array[1..1 shl 17] of byte;
begin
assign(f,'ssm.in'); reset(f);
assign(g,'ssm.out'); rewrite(g);
settextbuf(f,bufin);
settextbuf(g,bufout);
readln(f,n);
best:=-1;
max:=-maxlongint;
for i:=1 to n do
begin
read(f,nr);
if nr>best+nr then
begin
p:=i;
best:=nr;
end
else
best:=best+nr;
if best>max then
begin
max:=best;
pi:=p;
pf:=i;
end;
end;
writeln(g,max,' ',pi,' ',pf);
close(f);
close(g);
end.