Pagini recente » Cod sursa (job #605656) | Cod sursa (job #1718586) | Cod sursa (job #961119) | Cod sursa (job #1487990) | Cod sursa (job #1087707)
#include<stdio.h>
unsigned long long a,best[6000003],i,j,n,bestie,x,y,xi,yi,xu,yu;
using namespace std;
int main()
{
freopen("ssm.in","r",stdin);
freopen("ssm.out","w",stdout);
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%lld",&a);
if(i==1)
bestie=a;
best[i]=a;
xu=x;
yu=y;
x=i;
y=i;
if(best[i]<best[i-1]+a)
{
best[i]=best[i-1]+a;
x=xu;
y=yu+1;
}
if(bestie<best[i])
{
xi=x;
yi=y;
bestie=best[i];
}
}
printf("%d %d %d\n",bestie,xi,yi);
return 0;}