#include <bits/stdc++.h>
using namespace std;
int n, ar[1000005], freq[1000005], ans;
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i<= n; i++){
cin >> ar[i];
if (freq[ar[i]+1] == 1){
freq[ar[i]+1]--;
}
else{
ans++;
}
freq[ar[i]]++;
}
cout << ans << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
5 |
Incorrect |
51 ms |
6944 KB |
Output isn't correct |
6 |
Incorrect |
52 ms |
7244 KB |
Output isn't correct |
7 |
Incorrect |
42 ms |
5924 KB |
Output isn't correct |
8 |
Incorrect |
43 ms |
5872 KB |
Output isn't correct |
9 |
Incorrect |
53 ms |
6440 KB |
Output isn't correct |
10 |
Incorrect |
48 ms |
6452 KB |
Output isn't correct |