Result: Accepted
Time: 9ms
Memory: 1712kB
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <string>
#include <iostream>
#include <list>
#include <cstdlib>
#include <bitset>
#define lowbit(x) (x&(-x))
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
using namespace std;
int main()
{
int n;
while (~scanf("%d", &n))
{
int v;
int ans = 0, tot = 0;
for (int i = 0; i < n; ++i)
{
scanf("%d", &v);
if (v > 0)
tot += v / 2;
else
tot += v;
if (tot < 0)
++ans;
}
printf("%d\n", ans);
}
// system("pause");
}