# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696993 | allllekssssa | Money (IZhO17_money) | C++14 | 1 ms | 212 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]]++;
}
int ans = 0;
for (int i = 1; i <= n; i++) {
if (i < n && a[i] > a[i + 1]) {
++ans;
continue;
}
if (i == n) continue;
if (a[i] == a[i + 1]) 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... |