| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 697001 | allllekssssa | Money (IZhO17_money) | C++14 | 1575 ms | 5260 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 main() {
 
	cin >> n;
 
	for (int i = 1; i<=n; i++) {
		scanf("%d", &a[i]);
	}
    
    int ans = 0;
    int pre = 0;
	for (int i = 1; i < n; i++) {
		if (i < n && a[i] > a[i + 1]) {
			++ans;
			pre = i;
			continue;
		}
        
		if (a[i] == a[i + 1]) continue;
        
		for (int j = pre ; j > 0; j--) {
			if (a[j] > a[pre + 1] && a[j] < a[i + 1]) {
				++ans;
				pre = i;
                break;
			}
		}
	}
 
	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... | ||||
