#include<bits/stdc++.h>
using namespace std;
int N, arr[1000005];
multiset<int> S;
int main(){
cin >> N;
for( int i = 1; i <= N; i++ )
cin >> arr[i];
for( int i = 1; i <= N; i++ ){
if( S.find( arr[i] ) != S.end() ){
S.erase( S.find( arr[i] ) );
}
S.insert( arr[i] - 1 );
}
cout << (int)(S.size()) << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
575 ms |
3592 KB |
Output is correct |
6 |
Correct |
656 ms |
3916 KB |
Output is correct |
7 |
Correct |
531 ms |
3412 KB |
Output is correct |
8 |
Correct |
539 ms |
3472 KB |
Output is correct |
9 |
Correct |
565 ms |
3496 KB |
Output is correct |
10 |
Correct |
575 ms |
3576 KB |
Output is correct |