This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
int mp[N], urd[N];
int pm[N];
signed main(){
int n,q;
cin>>n>>q;
for(int i=0;i<n;i++)urd[i]=-1;
int ans=0;
int p=-1;
while(q--){
int x;
cin>>x;
if(x<0){
x*=-1;
if(urd[x]==1)mp[x]++;
urd[x]=1;
}
else{
if(urd[x]==0){
pm[x]++;
if(p==x)ans=max(ans,ans+1);
ans=max(ans,pm[x]);
}
urd[x]=0;
}
p=abs(x);
}
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... |