#include<bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
signed main(){
bool to[200005]={0};
unordered_set <int> s;
map <int, int> mp;
int n, q, ans=0;
cin>>n>>q;
for(int i=1; i<=q; i++){
int e;
cin>>e;
if(abs(e)==e){
if(to[e]==1){
mp[e]++;
ans++;
}
to[e]=1;
}
else{
e*=-1;
to[e]=0;
}
}
cout<<ans;
}
# | 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... |