#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 5e5;
signed main(){
int n;
cin >> n;
vector<int> a(n);
vector<int> b(n, 1);
for(int i = 0; i < n; i++){
cin >> a[i];
}
set<int> st;
for(int i = 0; i < n - 1; i++){
if(a[i] > a[i + 1] || a[i] + 1 < a[i + 1]){
st.insert(i + 1);
}
}
cout << st.size();
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |