#include <bits/stdc++.h>
#define MAXN 1000000
using namespace std;
void solve(){
int n; cin>>n;
int xd[n];
map <int,int> lol;
for (int i=0;i<n;i++){
cin>>xd[i];
lol[xd[i]]++;
}
int ans=0;
for (int i=0;i<n;i++){
if(lol[xd[i]-1]>0) lol[xd[i]-1]--;
else ans++;
lol[xd[i]]--;
}
cout<<ans<<endl;
}
int main() {
int t; t=1;
while(t--){
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
248 ms |
7192 KB |
Output isn't correct |
6 |
Incorrect |
224 ms |
7504 KB |
Output isn't correct |
7 |
Incorrect |
175 ms |
5972 KB |
Output isn't correct |
8 |
Incorrect |
177 ms |
5972 KB |
Output isn't correct |
9 |
Incorrect |
218 ms |
6648 KB |
Output isn't correct |
10 |
Incorrect |
201 ms |
6480 KB |
Output isn't correct |