Pagini recente » Cod sursa (job #596827) | Cod sursa (job #2005706) | Cod sursa (job #2414324) | Cod sursa (job #1986850) | Cod sursa (job #1645397)
#include <cstdio>
using namespace std;
long long n,best[6000005],i,in,sf,inmax,max1;
int main()
{
freopen("ssm.in","r",stdin);
freopen("ssm.out","w",stdout);
scanf("%lld",&n);
max1=-(1<<32);
for(i=1;i<=n;i++)
{
scanf("%lld",&best[i]);
if(best[i]+best[i-1]>best[i])
best[i]=best[i]+best[i-1];
else
if(best[i]>=best[i-1]+best[i])
in=i;
if(best[i]>max1)
{
max1=best[i];
inmax=in;
sf=i;
}
}
printf("%lld %lld %lld",max1,inmax,sf);
return 0;
}