제출 #409115

#제출 시각아이디문제언어결과실행 시간메모리
4091158e7Bigger segments (IZhO19_segments)C++14
0 / 100
1 ms212 KiB
//Challenge: Accepted
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <stack>
#include <set>
#define ll long long
#define maxn 1005
#define maxq 100005
#define mod 1000000007
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
signed main() {
	io
	int n;
	cin >> n;
	ll prv = 0, cur = 0;
	int ans = 0;
	for (int i = 0;i < n;i++)  {
		ll x;
		cin >> x;
		cur += x;
		if (cur >= prv) {
			prv = cur;
			ans++;
			cur = 0;
		}
	}
	cout << ans << endl;
}
/*
2
1 3
1
1 2 2

5
1 2 3 4 5
0

*/


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...