#include<bits/stdc++.h>
using namespace std;
int main()
{
ifstream in("input.txt");
ofstream out("output.txt");
int N;
in>>N;
int V[N];
for(int i = 0 ;i<N;i++)
{
in>>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;
}
}
out<<conta;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
1280 KB |
Output isn't correct |
2 |
Incorrect |
5 ms |
1280 KB |
Output isn't correct |
3 |
Incorrect |
5 ms |
1280 KB |
Output isn't correct |
4 |
Incorrect |
6 ms |
1408 KB |
Output isn't correct |
5 |
Incorrect |
6 ms |
1280 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
1280 KB |
Output isn't correct |
7 |
Incorrect |
5 ms |
1280 KB |
Output isn't correct |
8 |
Incorrect |
5 ms |
1408 KB |
Output isn't correct |
9 |
Incorrect |
5 ms |
1280 KB |
Output isn't correct |
10 |
Incorrect |
7 ms |
1280 KB |
Output isn't correct |