#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+10;
bitset<maxn> mark;
int h[maxn];
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n, ans=0;
cin >> n;
for(int i=1; i<=n; i++) cin >> h[i];
for(int i=n; i>=1; i--){
if(mark[h[i]-1]){
mark[h[i]-1] = false;
}
else{
ans++;
}
mark[h[i]] = true;
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
392 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
5 |
Incorrect |
88 ms |
7004 KB |
Output isn't correct |
6 |
Incorrect |
88 ms |
7288 KB |
Output isn't correct |
7 |
Incorrect |
73 ms |
6036 KB |
Output isn't correct |
8 |
Incorrect |
71 ms |
6008 KB |
Output isn't correct |
9 |
Incorrect |
81 ms |
6584 KB |
Output isn't correct |
10 |
Incorrect |
80 ms |
6648 KB |
Output isn't correct |