//#include<fstream>
#include<algorithm>
#include<iostream>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("karte.in");
//ofstream fout("karte.out");
int f[1000001],n,i,sol,a;
int main()
{
fin>>n;
for(i=1;i<=n;i++)
{
fin>>a;
if(f[a+1]==0) sol++;
else f[a+1]--;
f[a]++;
}
fout<<sol;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
372 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
334 ms |
632 KB |
Output is correct |
6 |
Correct |
335 ms |
632 KB |
Output is correct |
7 |
Correct |
267 ms |
632 KB |
Output is correct |
8 |
Correct |
265 ms |
656 KB |
Output is correct |
9 |
Correct |
294 ms |
504 KB |
Output is correct |
10 |
Correct |
299 ms |
620 KB |
Output is correct |