#include <iostream>
using namespace std;
long long n,i,s,x,x1,v[1000001],v1[1000001];
int main()
{
cin>>n;
for(i=1; i<=n; i++)
{
cin>>v[i];
}
for(i=1; i<=n; i++)
{
if(v[i]!=v[i-1]-1)
{
if(v1[v[i]]>0)
v1[v[i]]--;
else
{
s++;
v1[v[i]]=v[i];
}
}
}
cout<<s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
5 |
Incorrect |
179 ms |
6692 KB |
Output isn't correct |
6 |
Incorrect |
192 ms |
7260 KB |
Output isn't correct |
7 |
Incorrect |
143 ms |
5924 KB |
Output isn't correct |
8 |
Incorrect |
150 ms |
5872 KB |
Output isn't correct |
9 |
Incorrect |
163 ms |
6368 KB |
Output isn't correct |
10 |
Incorrect |
165 ms |
6552 KB |
Output isn't correct |