#include<bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include <stdlib.h>
#define ll long long
using namespace std;
ll k[500006],a,b,c,d,e,f,m,i,j,n,h,g,l,r,ka,p,q[200005],t[200005];
map<ll,ll> maa,mii,mee;
vector<ll> vas[25],vis,vii;
int main(){
cin>>a;
cin>>b;
k[0]=0;
for(i=1 ; i<=b ; i++){
cin>>t[i];
if(k[i-1]>k[maa[abs(t[i])]] || maa[abs(t[i])]==0 || t[maa[abs(t[i])]]!=t[i] || t[i]<0){
k[i]=k[i-1];
}
else{
k[i]=k[i-1]+1;
}
maa[abs(t[i])]=i;
}
cout<<k[b];
}
# | 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... |