답안 #914784

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914784 2024-01-22T16:36:06 Z mariamp1 Money (IZhO17_money) C++14
100 / 100
1268 ms 58032 KB
# include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pii pair <int, int>
#define pb push_back
const int N = 3e5 + 5;
int n, q, mn, r, mx;
int main() {
    cin>>n;
    int a[n+1];
    set<int> s;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        mn = a[i];
        ans++;
        for (int j = i; j <= n; j++){
            if(j == n) {r = n; break;}
            if(a[j+1] < a[j]) { r = j; break; }
            mx = a[j + 1];
            auto it = s.upper_bound(mn);
            if (it != s.end() && *it < mx) { r = j; break; }
        }
        for(int j = i; j <= r; j++){
            s.insert(a[j]);
        }
        i = r;
    }
    cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 356 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 356 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 440 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 604 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 356 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 440 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 604 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 1 ms 856 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 356 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 440 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 604 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 1 ms 856 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 121 ms 5476 KB Output is correct
40 Correct 198 ms 8744 KB Output is correct
41 Correct 111 ms 4492 KB Output is correct
42 Correct 82 ms 3920 KB Output is correct
43 Correct 64 ms 3020 KB Output is correct
44 Correct 251 ms 11052 KB Output is correct
45 Correct 247 ms 10960 KB Output is correct
46 Correct 264 ms 11352 KB Output is correct
47 Correct 241 ms 11104 KB Output is correct
48 Correct 242 ms 10964 KB Output is correct
49 Correct 438 ms 29532 KB Output is correct
50 Correct 527 ms 29612 KB Output is correct
51 Correct 467 ms 29388 KB Output is correct
52 Correct 537 ms 29588 KB Output is correct
53 Correct 500 ms 29524 KB Output is correct
54 Correct 462 ms 29396 KB Output is correct
55 Correct 1104 ms 58000 KB Output is correct
56 Correct 1088 ms 57816 KB Output is correct
57 Correct 1037 ms 57808 KB Output is correct
58 Correct 1252 ms 57852 KB Output is correct
59 Correct 1138 ms 58032 KB Output is correct
60 Correct 1160 ms 57788 KB Output is correct
61 Correct 1170 ms 57940 KB Output is correct
62 Correct 1268 ms 57816 KB Output is correct