提交时间:2022-07-20 12:05:29
运行 ID: 52871
#include <bits/stdc++.h> using namespace std; int main() { // freopen("height.in", "r", stdin); // freopen("height.out", "w", stdout); int N(0); cin >> N; long long sum(0); for (int i(0), p(-1), v(0), x(0); i != N; ++i) { cin >> x; if (x < v) sum += i - p; if (x > v) p = i, v = x; } cout << sum << endl; return 0; }