#include<bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin>>N;
int V[N];
for(int i = 0 ;i<N;i++)
{
cin>>V[i];
}
bool H[1000002];
int conta = 0;
for(int i = 1;i<=1000001;i++)
{
H[i] = false;
}
for(int i = 0;i<N;i++)
{
int a = V[i];
if(H[a+1])
{
H[a+1] = false;
H[a] = true;
}
else
{
conta++;
H[a] = true;
}
}
cout<<conta;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
1280 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
1280 KB |
Output isn't correct |
3 |
Incorrect |
7 ms |
1280 KB |
Output isn't correct |
4 |
Incorrect |
7 ms |
1280 KB |
Output isn't correct |
5 |
Incorrect |
285 ms |
7928 KB |
Output isn't correct |
6 |
Incorrect |
296 ms |
8312 KB |
Output isn't correct |
7 |
Incorrect |
243 ms |
7032 KB |
Output isn't correct |
8 |
Incorrect |
237 ms |
7032 KB |
Output isn't correct |
9 |
Incorrect |
268 ms |
7532 KB |
Output isn't correct |
10 |
Incorrect |
262 ms |
7544 KB |
Output isn't correct |