#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6+1;
const int p1 = 37;
const int p2 = 30;
const int md = 1e9+7;
const int mod = 998244353;
pair<int, int> a[N];
int pw1[N], pw2[N];
void build(string s, int n){
pw1[0] = pw2[0] = 1;
for (int i = 1; i < n; i++){
pw1[i] = pw1[i-1] * p1 % md;
pw2[i] = pw2[i-1] * p2 % mod;
} int dig = s[0] - 'a' + 1;
a[0] = {dig, dig};
for (int i = 1; i < n; i++){
int dig = s[i] - 'a' + 1;
a[i] = {a[i-1].first * p1 + dig % md, a[i-1].second * p2 + dig % mod};
}
}
pair<int, int> get(int l, int r){
if (!l) return a[r];
return {(((a[r].first - a[l-1].first * pw1[r - l + 1]) % md) + md) % md, (((a[r].second - a[l-1].second * pw2[r - l + 1]) % mod) + mod) % mod};
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(nullptr); (0);
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++){
cin >> v[i];
} int ans = 0;
for (int i = 1; i < n; i++){
if (v[i-1] > v[i]) ans++;
} cout << ans;
}
# | 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... |