Pagini recente » Cod sursa (job #2769561) | Cod sursa (job #778476) | Cod sursa (job #727762) | Cod sursa (job #342407) | Cod sursa (job #901108)
Cod sursa(job #901108)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<bitset>
#define INF 0x3f3f3f3f
#define mp make_pair
#define pb push_back
#define maxn 6000010
using namespace std;
int best[maxn],n,dr,st,st_f,i,maxi;
int main()
{
freopen("ssm.in","r",stdin);
freopen("ssm.out","w",stdout);
scanf("%d%d",&n,&best[1]);
maxi=best[1]; st=dr=1;
for(i=2; i<=n; ++i)
{
scanf("%d",&best[i]);
if(best[i]<=best[i-1]+best[i])
best[i]=best[i-1]+best[i];
else
st=i;
if(maxi<best[i])
maxi=best[i],dr=i,st_f=st;
}
printf("%d %d %d\n",maxi,st_f,dr);
return 0;
}