#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int> > v(n);
for(int i=0;i<n;i++){
cin>>v[i].first;
v[i].second=i;
}
sort(v.rbegin(),v.rend());
int cont=1;
for(int i=1;i<n;i++){
if(v[i].first==v[i-1].first-1&&v[i].second>v[i-1].second)continue;
else cont++;
}
cout<<cont<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
5 |
Incorrect |
317 ms |
10220 KB |
Output isn't correct |
6 |
Incorrect |
346 ms |
10856 KB |
Output isn't correct |
7 |
Incorrect |
272 ms |
9004 KB |
Output isn't correct |
8 |
Incorrect |
275 ms |
8940 KB |
Output isn't correct |
9 |
Incorrect |
332 ms |
9536 KB |
Output isn't correct |
10 |
Incorrect |
300 ms |
9836 KB |
Output isn't correct |