#include <iostream>
using namespace std;
int n,i,v[1000005],f[1000005];
int main()
{
cin >> n;
for (i=1; i<=n; i++)
cin >> v[i];
f[v[1]] = 1; int sol = 1;
for (i=2; i<=n; i++)
{
if (f[v[i]+1] == 0)
sol++;
f[v[i]] = 1;
}
cout << sol;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
5 |
Incorrect |
331 ms |
7032 KB |
Output isn't correct |
6 |
Incorrect |
338 ms |
7452 KB |
Output isn't correct |
7 |
Incorrect |
271 ms |
6136 KB |
Output isn't correct |
8 |
Incorrect |
270 ms |
6136 KB |
Output isn't correct |
9 |
Incorrect |
308 ms |
6648 KB |
Output isn't correct |
10 |
Incorrect |
309 ms |
6564 KB |
Output isn't correct |