#include<bits/stdc++.h>
#define ll long long
using namespace std;
void uwu(){
ll n,q;
cin>>n>>q;
set<ll> a;
ll ans=0;
for(ll i=0; i<q; i++){
ll x;
cin>>x;
if(x>0){
if(a.count(x)==0){
a.insert(x);
}else{
a.clear();
a.insert(x);
ans++;
}
}else{
if(a.count(abs(x))==1) a.erase(x);
}
}
cout<<ans<<"\n";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll t=1;
//cin>>t;
while(t--){
uwu();
}
}
# | 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... |