#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
ll n, q, x, ans = 0;
cin >> n >> q;
bool b[n]{};
while(q--)
{
cin >> x;
if (x < 0)
b[-x] = false;
else
{
if (b[x]) {
++ans;
memset(b, false, sizeof(b));
}
b[x] = true;
}
}
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... |