# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696991 | allllekssssa | Money (IZhO17_money) | C++14 | 1 ms | 468 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int maxN = 1e6 + 10;
int a[maxN];
int n;
int cnt[maxN];
int main() {
cin >> n;
for (int i = 1; i<=n; i++) {
scanf("%d", &a[i]);
cnt[a[i]]++;
assert(cnt[a[i]] == 1);
}
int ans = 0;
for (int i = 1; i <= n; i++) {
if (i < n && a[i] > a[i + 1]) {
++ans;
continue;
}
for (int j = i - 1; j > 0; j--) {
if (a[j] > a[i] && a[j] < a[i + 1]) {
++ans;
}
}
}
cout << ans + 1 << endl;
}
Compilation message (stderr)
# | 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... |