Pagini recente » Borderou de evaluare (job #1959968) | Cod sursa (job #2554136) | Cod sursa (job #2051357) | Cod sursa (job #1905861) | Cod sursa (job #701873)
Cod sursa(job #701873)
program inf;
var a,v:array[0..6000000] of longint;
n,pj,pozi,pozj,pi,max,s,i:longint;
f,g:text;
begin
assign(f,'ssm.in'); reset (f);
assign(g,'ssm.out'); rewrite (g);
readln (f,n);
max:=-maxlongint;
pj:=1;
for i:=1 to n do
begin
read (f,v[i]);
s:=v[i]+a[i-1];
if s>=v[i] then
a[i]:=s
else
begin
a[i]:=v[i];
pi:=i;
end;
if max<=a[i] then
begin
max:=a[i];
pozi:=pi;
pozj:=pj;
end;
pj:=pj+1;
end;
if pozi=0 then
write (g,max,' ',pozi+1,' ',pozj)
else
write (g,max,' ',pozi,' ',pozj);
close(f);
close(g);
end.