Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Codeforces 427A
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, q, pol = 0, rez = 0;
- cin >> n;
- for( int i = 0; i < n; i++ )
- {
- cin >> q;
- if( q == -1 )
- {
- if( pol > 0 )
- {
- pol--;
- }
- else
- {
- rez++;
- }
- }
- else
- {
- pol += q;
- }
- }
- cout << rez;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement