| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 37383 | HardNut | Money (IZhO17_money) | C++14 | 1500 ms | 6320 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 N = 1e6 + 5;
typedef long long ll;
int n, a[N], ans;
set<int> st;
bool us;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    int i = 1;
    st.insert((int)1e9);
    while (i <= n) {
        int x = *upper_bound(st.begin(), st.end(), a[i]);
        int l = i;
        while (a[i + 1] >= a[i] && a[i + 1] <= x) {
            i++;
        }
        for (int j = l; j <= i; j++) {
            st.insert(a[j]);
        }
        i++;
        ans++;
    }
    printf("%d", ans);
}
/**
6
1 5 2 5 5 6
**/
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... | ||||
