This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int v[200005];
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int m, n; cin >> m >> n;
int mx = 0;
while(n--){
int x; cin >> x;
if(x > 0){
if(v[x] == mx) v[x] = ++mx;
else v[x] = mx;
}else if(v[-x] != 0) v[-x]--;
}
cout << max(mx - 1ll, 0ll) << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |