Source Code
//============================================================================
// Name        : mmmmmmmm.cpp
// Author      : sameh mohamed
// Copyright   : don't try i'm warnning you......
// Description : Hello World
//============================================================================
//Egypt came then History
//Pharoas were coders but using different compilers{}{}{}{}{}}}}{{{{@#$%^^&&$$$###()()(***)))([][][][][]]][
#include<bits/stdc++.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int main()
{
int n;
cin>>n;
vector<long>a;
for(int i=0;i<n;i++)
{
	long v;
	cin>>v;
	a.push_back(v);
}
long s=LONG_MIN;
long m=0;
for(int i=0;i<n;i++)
{
	m+=a[i];
	if(m>s)
		s=m;
	if(m<0)
		m=0;
}
cout<<s;
return 0;
}
Copy
Movies sameh58
GNU G++17
220 ms
9.2 MB
Wrong Answer