답안 #587867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
587867 2022-07-02T12:34:48 Z MasterTaster Money (IZhO17_money) C++14
100 / 100
1159 ms 58152 KB
#include <iostream>
#include<set>

#define MAXN 1000010

using namespace std;

int n, a[MAXN], ress;

int main() {
    cin>>n;
    for (int i=0; i<n; i++) cin>>a[i];

    set<int> s;
    int i=0;
    while (i<n)
    {
        auto it=s.upper_bound(a[i]);
        bool nema=0; int br;
        if (it==s.end()) nema=1;
        else br=*it;

        s.insert(a[i]);
        i++;
        while (i<n && (i==0 || a[i]>=a[i-1]) && (nema || a[i]<=br)) { s.insert(a[i]); i++; }

        //cout<<i<<endl;
        ress++;
    }
    cout<<ress;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 216 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 216 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 304 KB Output is correct
20 Correct 0 ms 308 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 216 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 304 KB Output is correct
20 Correct 0 ms 308 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 300 KB Output is correct
30 Correct 0 ms 304 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 304 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 216 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 304 KB Output is correct
20 Correct 0 ms 308 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 300 KB Output is correct
30 Correct 0 ms 304 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 304 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 141 ms 5364 KB Output is correct
40 Correct 257 ms 8724 KB Output is correct
41 Correct 113 ms 4340 KB Output is correct
42 Correct 107 ms 3924 KB Output is correct
43 Correct 74 ms 2796 KB Output is correct
44 Correct 312 ms 10924 KB Output is correct
45 Correct 291 ms 11000 KB Output is correct
46 Correct 301 ms 10960 KB Output is correct
47 Correct 302 ms 11020 KB Output is correct
48 Correct 287 ms 11028 KB Output is correct
49 Correct 598 ms 29364 KB Output is correct
50 Correct 693 ms 29356 KB Output is correct
51 Correct 610 ms 29516 KB Output is correct
52 Correct 568 ms 29400 KB Output is correct
53 Correct 583 ms 29516 KB Output is correct
54 Correct 596 ms 29352 KB Output is correct
55 Correct 1099 ms 57928 KB Output is correct
56 Correct 1108 ms 57916 KB Output is correct
57 Correct 1132 ms 57916 KB Output is correct
58 Correct 1131 ms 57828 KB Output is correct
59 Correct 1124 ms 58096 KB Output is correct
60 Correct 1111 ms 57912 KB Output is correct
61 Correct 1159 ms 58152 KB Output is correct
62 Correct 1114 ms 57868 KB Output is correct