#include <iostream>
#include <vector>
using namespace std;
int n, i, j, x, f[1000005], sol, nrcrt, h, ant;
vector<int>a[1000005];
int main(){
cin>>n;
for(i=1; i<=n; i++){
cin>>x;
f[x]++;
if(f[x+1]==0){
sol++;
}else{
f[x+1]--;
}
}
cout<<sol;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
23800 KB |
Output is correct |
2 |
Correct |
25 ms |
23800 KB |
Output is correct |
3 |
Correct |
26 ms |
23800 KB |
Output is correct |
4 |
Correct |
26 ms |
23804 KB |
Output is correct |
5 |
Correct |
349 ms |
27436 KB |
Output is correct |
6 |
Correct |
354 ms |
27300 KB |
Output is correct |
7 |
Correct |
293 ms |
26744 KB |
Output is correct |
8 |
Correct |
287 ms |
26616 KB |
Output is correct |
9 |
Correct |
327 ms |
27128 KB |
Output is correct |
10 |
Correct |
324 ms |
27000 KB |
Output is correct |