Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
52848 | Ghost_Chris | 木薯与身高 | C++ | 解答错误 | 30 | 41 MS | 4160 KB | 721 | 2022-07-20 12:03:07 |
#include <bits/stdc++.h> using namespace std; inline int read(){ register int x(0); register short w(1); register char c(getchar()); for (;c < '0' || c > '9';c = getchar()) if (c == '-') w = -1; for (;c >= '0' && c <= '9';c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); return x * w; } const int N(1000010); int n,ans; int a[N]; int main(){ n = read(),a[1] = read();int val(0),cur(-1); for (int i(2);i <= n;i++) a[i] = read();int maxn = a[1]; for (int i(2);i <= n;i++) { if (a[i] > maxn) { maxn = max(a[i],maxn); continue; } maxn = max(a[i],maxn); for (int j(1);j < i;j++) if(a[j] > a[i]) { ans += i - j; break; } } cout << ans; return 0; }