Submission #36949

# Submission time Handle Problem Language Result Execution time Memory
36949 2017-12-19T14:29:50 Z nickyrio Money (IZhO17_money) C++14
45 / 100
1500 ms 51204 KB
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i<=b ; i++)
#define FORD(i, a, b) for (int i = a; i>=b; i--)
#define REP(i, a) for (int i = 0; i<a; i++)
#define N 1001000
#define pp pair<int, int>
#define IO cin.tie(NULL);cout.tie(NULL);
#define bit(S, i) (((S) >> i) & 1)
template<typename T> inline void read(T &x) {
    char c;
    bool neg = false;
    while (!isdigit(c = getchar()) && c != '-');
    x = 0;
    if (c == '-') {
        neg = true;
        c = getchar();
    }
    do {
        x = x * 10 + c - '0';
    } while (isdigit(c = getchar()));
    if (neg) x = -x;
}
template<typename T> inline void write(T x) {
    if (x < 0) {
        putchar('-');
        write(-x);return;
    }
    if (x < 10) {
        putchar(char(x + 48));
    }
    else {
        write(x/10);
        putchar(char(48 + x%10));
    }
}
template<typename T> inline void writeln(T x) {
    write(x);
    putchar('\n');
}
using namespace std;
int n, a[N];
set<int> used;
int main() {
    IO;
    read(n);
    FOR(i, 1, n) read(a[i]);
    int start = 1;
    int cnt = 0;
    while (start <= n) {
        cnt++;
        int last = start + 1;
        used.insert(a[start]);
        int lim;
        if (used.upper_bound(a[start]) == used.end()) lim = 1e9;
        else lim = *used.upper_bound(a[start]);
        while (last <= n && a[last] <= lim && a[last] >= a[last - 1]) {
            used.insert(a[last]); last++; 
        }
        start = last;
    }
    writeln(cnt);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5928 KB Output is correct
2 Correct 0 ms 5928 KB Output is correct
3 Correct 0 ms 5928 KB Output is correct
4 Correct 0 ms 5928 KB Output is correct
5 Correct 0 ms 5928 KB Output is correct
6 Correct 0 ms 5928 KB Output is correct
7 Correct 0 ms 5928 KB Output is correct
8 Correct 0 ms 5928 KB Output is correct
9 Correct 0 ms 5928 KB Output is correct
10 Correct 0 ms 5928 KB Output is correct
11 Correct 0 ms 5928 KB Output is correct
12 Correct 0 ms 5928 KB Output is correct
13 Correct 0 ms 5928 KB Output is correct
14 Correct 0 ms 5928 KB Output is correct
15 Correct 0 ms 5928 KB Output is correct
16 Correct 0 ms 5928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5928 KB Output is correct
2 Correct 0 ms 5928 KB Output is correct
3 Correct 0 ms 5928 KB Output is correct
4 Correct 0 ms 5928 KB Output is correct
5 Correct 0 ms 5928 KB Output is correct
6 Correct 0 ms 5928 KB Output is correct
7 Correct 0 ms 5928 KB Output is correct
8 Correct 0 ms 5928 KB Output is correct
9 Correct 0 ms 5928 KB Output is correct
10 Correct 0 ms 5928 KB Output is correct
11 Correct 0 ms 5928 KB Output is correct
12 Correct 0 ms 5928 KB Output is correct
13 Correct 0 ms 5928 KB Output is correct
14 Correct 0 ms 5928 KB Output is correct
15 Correct 0 ms 5928 KB Output is correct
16 Correct 0 ms 5928 KB Output is correct
17 Correct 0 ms 5928 KB Output is correct
18 Correct 0 ms 5928 KB Output is correct
19 Correct 0 ms 5928 KB Output is correct
20 Correct 0 ms 5928 KB Output is correct
21 Correct 0 ms 5928 KB Output is correct
22 Correct 0 ms 5928 KB Output is correct
23 Correct 0 ms 5928 KB Output is correct
24 Correct 0 ms 5928 KB Output is correct
25 Correct 0 ms 5928 KB Output is correct
26 Correct 0 ms 5928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5928 KB Output is correct
2 Correct 0 ms 5928 KB Output is correct
3 Correct 0 ms 5928 KB Output is correct
4 Correct 0 ms 5928 KB Output is correct
5 Correct 0 ms 5928 KB Output is correct
6 Correct 0 ms 5928 KB Output is correct
7 Correct 0 ms 5928 KB Output is correct
8 Correct 0 ms 5928 KB Output is correct
9 Correct 0 ms 5928 KB Output is correct
10 Correct 0 ms 5928 KB Output is correct
11 Correct 0 ms 5928 KB Output is correct
12 Correct 0 ms 5928 KB Output is correct
13 Correct 0 ms 5928 KB Output is correct
14 Correct 0 ms 5928 KB Output is correct
15 Correct 0 ms 5928 KB Output is correct
16 Correct 0 ms 5928 KB Output is correct
17 Correct 0 ms 5928 KB Output is correct
18 Correct 0 ms 5928 KB Output is correct
19 Correct 0 ms 5928 KB Output is correct
20 Correct 0 ms 5928 KB Output is correct
21 Correct 0 ms 5928 KB Output is correct
22 Correct 0 ms 5928 KB Output is correct
23 Correct 0 ms 5928 KB Output is correct
24 Correct 0 ms 5928 KB Output is correct
25 Correct 0 ms 5928 KB Output is correct
26 Correct 0 ms 5928 KB Output is correct
27 Correct 0 ms 5928 KB Output is correct
28 Correct 0 ms 5928 KB Output is correct
29 Correct 0 ms 5928 KB Output is correct
30 Correct 0 ms 5928 KB Output is correct
31 Correct 0 ms 5928 KB Output is correct
32 Correct 0 ms 5928 KB Output is correct
33 Correct 0 ms 5928 KB Output is correct
34 Correct 0 ms 5928 KB Output is correct
35 Correct 0 ms 5928 KB Output is correct
36 Correct 0 ms 5928 KB Output is correct
37 Correct 0 ms 5928 KB Output is correct
38 Correct 0 ms 5928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5928 KB Output is correct
2 Correct 0 ms 5928 KB Output is correct
3 Correct 0 ms 5928 KB Output is correct
4 Correct 0 ms 5928 KB Output is correct
5 Correct 0 ms 5928 KB Output is correct
6 Correct 0 ms 5928 KB Output is correct
7 Correct 0 ms 5928 KB Output is correct
8 Correct 0 ms 5928 KB Output is correct
9 Correct 0 ms 5928 KB Output is correct
10 Correct 0 ms 5928 KB Output is correct
11 Correct 0 ms 5928 KB Output is correct
12 Correct 0 ms 5928 KB Output is correct
13 Correct 0 ms 5928 KB Output is correct
14 Correct 0 ms 5928 KB Output is correct
15 Correct 0 ms 5928 KB Output is correct
16 Correct 0 ms 5928 KB Output is correct
17 Correct 0 ms 5928 KB Output is correct
18 Correct 0 ms 5928 KB Output is correct
19 Correct 0 ms 5928 KB Output is correct
20 Correct 0 ms 5928 KB Output is correct
21 Correct 0 ms 5928 KB Output is correct
22 Correct 0 ms 5928 KB Output is correct
23 Correct 0 ms 5928 KB Output is correct
24 Correct 0 ms 5928 KB Output is correct
25 Correct 0 ms 5928 KB Output is correct
26 Correct 0 ms 5928 KB Output is correct
27 Correct 0 ms 5928 KB Output is correct
28 Correct 0 ms 5928 KB Output is correct
29 Correct 0 ms 5928 KB Output is correct
30 Correct 0 ms 5928 KB Output is correct
31 Correct 0 ms 5928 KB Output is correct
32 Correct 0 ms 5928 KB Output is correct
33 Correct 0 ms 5928 KB Output is correct
34 Correct 0 ms 5928 KB Output is correct
35 Correct 0 ms 5928 KB Output is correct
36 Correct 0 ms 5928 KB Output is correct
37 Correct 0 ms 5928 KB Output is correct
38 Correct 0 ms 5928 KB Output is correct
39 Correct 63 ms 5928 KB Output is correct
40 Correct 129 ms 5928 KB Output is correct
41 Correct 39 ms 5928 KB Output is correct
42 Correct 39 ms 5928 KB Output is correct
43 Correct 23 ms 5928 KB Output is correct
44 Correct 103 ms 5928 KB Output is correct
45 Correct 106 ms 5928 KB Output is correct
46 Correct 116 ms 5928 KB Output is correct
47 Correct 99 ms 5928 KB Output is correct
48 Correct 86 ms 5928 KB Output is correct
49 Correct 876 ms 24408 KB Output is correct
50 Correct 843 ms 24408 KB Output is correct
51 Correct 879 ms 24408 KB Output is correct
52 Correct 903 ms 24408 KB Output is correct
53 Correct 1173 ms 24408 KB Output is correct
54 Correct 1016 ms 24408 KB Output is correct
55 Execution timed out 1500 ms 51204 KB Execution timed out
56 Halted 0 ms 0 KB -