Submission #513767

# Submission time Handle Problem Language Result Execution time Memory
513767 2022-01-17T15:17:48 Z blue Money (IZhO17_money) C++17
100 / 100
910 ms 54376 KB
#include <iostream>
#include <set>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int N;
    cin >> N;

    int a[1+N];
    for(int i = 1; i <= N; i++) cin >> a[i];
    a[0] = 1'000'001;

    set<int> A;

    int res = 0;

    A.insert(1'000'001);

    int lim = 1'000'001;


    for(int i = 1; i <= N; i++)
    {
        // cerr << i << " : " << "a[i] = " << a[i] << ", lim = " << lim << "\n";
        if(a[i] < a[i-1] || a[i] > lim)
        {
            // cerr << "case 1\n";
            res++;
            lim = *A.lower_bound(a[i]+1);
            A.insert(a[i]);
        }
        else
        {
            // cerr << "case 2\n";
            // if(a[i] > lim)
            A.insert(a[i]);
        }
    }

    cout << res << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 220 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 300 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 316 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 316 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 220 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 300 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 316 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 316 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 312 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 312 KB Output is correct
32 Correct 0 ms 312 KB Output is correct
33 Correct 1 ms 316 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 312 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 220 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 300 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 316 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 316 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 312 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 312 KB Output is correct
32 Correct 0 ms 312 KB Output is correct
33 Correct 1 ms 316 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 312 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 1 ms 312 KB Output is correct
39 Correct 57 ms 5352 KB Output is correct
40 Correct 81 ms 6524 KB Output is correct
41 Correct 38 ms 4292 KB Output is correct
42 Correct 37 ms 3932 KB Output is correct
43 Correct 29 ms 2988 KB Output is correct
44 Correct 100 ms 7244 KB Output is correct
45 Correct 98 ms 7188 KB Output is correct
46 Correct 124 ms 7296 KB Output is correct
47 Correct 87 ms 7376 KB Output is correct
48 Correct 89 ms 7264 KB Output is correct
49 Correct 371 ms 25820 KB Output is correct
50 Correct 394 ms 25924 KB Output is correct
51 Correct 376 ms 25800 KB Output is correct
52 Correct 386 ms 25784 KB Output is correct
53 Correct 370 ms 25832 KB Output is correct
54 Correct 374 ms 25736 KB Output is correct
55 Correct 898 ms 54268 KB Output is correct
56 Correct 904 ms 54228 KB Output is correct
57 Correct 905 ms 54292 KB Output is correct
58 Correct 892 ms 54340 KB Output is correct
59 Correct 886 ms 54364 KB Output is correct
60 Correct 861 ms 54364 KB Output is correct
61 Correct 866 ms 54376 KB Output is correct
62 Correct 910 ms 54340 KB Output is correct