# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
758188 | vjudge1 | Money (IZhO17_money) | C++17 | 1 ms | 332 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 mxN = 1e6 + 7;
int arr[mxN];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
int ans = 0;
for (int i = 0; i < n; ++i) {
while (i + 1 < n) {
bool ok = (arr[i] < arr[i + 1]);
for (int j = 0; j < i; ++j) {
if (arr[i] == arr[j] || arr[i + 1] == arr[j]) {
continue;
}
if (arr[i] < arr[j] != arr[i + 1] < arr[j] ||
arr[i] > arr[j] != arr[i + 1] > arr[j]) {
ok = false;
}
}
if (!ok) {
break;
}
++i;
}
++ans;
}
cout << ans << "\n";
}
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... |