#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >> n;
multiset <ll> num;
for(ll i = 0; i < n; i++){
ll a;
cin >> a;
if(num.empty()){
num.insert(a);
}else{
multiset <ll>::iterator it;
it = num.lower_bound(a + 1);
if(it == num.end()){
num.insert(a);
}else if(*it == a + 1){
num.erase(it);
num.insert(a);
}
}
}
cout << num.size();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
3 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
280 ms |
2424 KB |
Output isn't correct |
6 |
Incorrect |
292 ms |
2552 KB |
Output isn't correct |
7 |
Incorrect |
238 ms |
2552 KB |
Output isn't correct |
8 |
Incorrect |
234 ms |
2424 KB |
Output isn't correct |
9 |
Incorrect |
265 ms |
2428 KB |
Output isn't correct |
10 |
Incorrect |
258 ms |
2552 KB |
Output isn't correct |