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;
int ans=0;
while(q--){
int x;
cin>>x;
if(x>0){
mp[x]=max(mp[x]+1,ans+1);
if(mp[x]==ans+2){
ans++;
}
}
else{
mp[-x]=ans;
}
}
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... |