#include <iostream>
using namespace std;
int main()
{
int n,q; int a[300000]; int cnt=0;
cin>>n;
cin>>q;
int f[300000] = {0};
for(int i=1; i<=q; i++){cin>>a[i];}
for(int i=1; i<=q; i++){
if(a[i]>0){
if(f[a[i]]==1){cnt++;}
f[a[i]] = 1;
}
else {f[-a[i]] = 0;}
}
cout<<cnt;
}
# | 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... |