#include <iostream>
using namespace std;
int i,n,j,v[1000010],sageata,f[1000010];
int main(){
cin>>n;
for(i=1;i<=n;i++)
cin>>v[i];
for(i=1;i<=n;i++){
if(f[v[i]]==0)
sageata++;
if(f[v[i]]>0)
f[v[i]]--;
f[v[i]-1]++;
}
cout<<sageata;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
380 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
337 ms |
7048 KB |
Output is correct |
6 |
Correct |
342 ms |
7288 KB |
Output is correct |
7 |
Correct |
276 ms |
6008 KB |
Output is correct |
8 |
Correct |
274 ms |
5988 KB |
Output is correct |
9 |
Correct |
309 ms |
6524 KB |
Output is correct |
10 |
Correct |
303 ms |
6588 KB |
Output is correct |