Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int st , dr, Smax = -2000000000 , S = -1, start;
- for(int i = 1 ; i <= n ; ++ i)
- {
- if(S < 0)
- S = 0, start = i;
- S += A[i];
- if(S > Smax)
- Smax = S, st = start, dr = i;
- }
- cout << Smax << endl;
- cout << st << " " << dr;
Add Comment
Please, Sign In to add comment