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;
const int MAXN = 200'000;
int v[MAXN];
int main()
{
int n, q, i, x, ans = 0, lastdeleted;
cin >> n >> q;
lastdeleted = 0;
for(i = 1; i <= q; i++){
cin >> x;
if(x < 0){
v[-x] = 0;
}
else{
if(v[x] > lastdeleted){
ans++;
v[x] = i + 1;
lastdeleted = i;
}
else
v[x] = i;
}
}
cout << ans << "\n";
return 0;
}
# | 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... |