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;
int main()
{
int n,m,a;
cin>>n>>m;
vector<int>v(n);
int cnt=0;
for(int i=0;i<m;i++)
{
cin>>a;
if(a>0)
{
v[a]=max(cnt+1,v[a]+1);
if(v[a]==cnt+2)
{
cnt++;
}
}
else
{
v[a]=cnt;
}
}
cout<<cnt;
return 0;
}
# | 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... |