답안 #398997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
398997 2021-05-05T02:19:08 Z KoD Global Warming (CEOI18_glo) C++17
100 / 100
67 ms 4596 KB
#include <bits/stdc++.h>

template <class T>
using Vec = std::vector<T>;

constexpr int INF = std::numeric_limits<int>::max() / 2;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N, X;
    std::cin >> N >> X;
    Vec<int> A(N);
    for (auto& x: A) {
        std::cin >> x;
    }    
    Vec<int> up(N + 1, INF), down(N + 1, INF);
    up[0] = down[0] = -INF;
    for (const auto x: A) {
        const int u = std::lower_bound(up.begin(), up.end(), x) - up.begin();
        const int d = std::lower_bound(down.begin(), down.end(), x) - down.begin();
        up[u] = x;
        down[d] = x;
        down[u] = std::min(down[u], x - X);
    }
    std::cout << std::lower_bound(down.begin(), down.end(), INF) - down.begin() - 1 << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 324 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 52 ms 4548 KB Output is correct
2 Correct 51 ms 4544 KB Output is correct
3 Correct 50 ms 4552 KB Output is correct
4 Correct 49 ms 4596 KB Output is correct
5 Correct 38 ms 3788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1408 KB Output is correct
2 Correct 13 ms 1400 KB Output is correct
3 Correct 12 ms 1352 KB Output is correct
4 Correct 10 ms 1204 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 10 ms 1264 KB Output is correct
7 Correct 11 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 2376 KB Output is correct
2 Correct 25 ms 2472 KB Output is correct
3 Correct 67 ms 4556 KB Output is correct
4 Correct 42 ms 3788 KB Output is correct
5 Correct 20 ms 2080 KB Output is correct
6 Correct 37 ms 3752 KB Output is correct
7 Correct 39 ms 4348 KB Output is correct
8 Correct 21 ms 2376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 324 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 52 ms 4548 KB Output is correct
28 Correct 51 ms 4544 KB Output is correct
29 Correct 50 ms 4552 KB Output is correct
30 Correct 49 ms 4596 KB Output is correct
31 Correct 38 ms 3788 KB Output is correct
32 Correct 12 ms 1408 KB Output is correct
33 Correct 13 ms 1400 KB Output is correct
34 Correct 12 ms 1352 KB Output is correct
35 Correct 10 ms 1204 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 10 ms 1264 KB Output is correct
38 Correct 11 ms 1356 KB Output is correct
39 Correct 27 ms 2376 KB Output is correct
40 Correct 25 ms 2472 KB Output is correct
41 Correct 67 ms 4556 KB Output is correct
42 Correct 42 ms 3788 KB Output is correct
43 Correct 20 ms 2080 KB Output is correct
44 Correct 37 ms 3752 KB Output is correct
45 Correct 39 ms 4348 KB Output is correct
46 Correct 21 ms 2376 KB Output is correct
47 Correct 24 ms 2460 KB Output is correct
48 Correct 24 ms 2480 KB Output is correct
49 Correct 50 ms 4556 KB Output is correct
50 Correct 41 ms 3788 KB Output is correct
51 Correct 32 ms 2892 KB Output is correct
52 Correct 40 ms 3932 KB Output is correct
53 Correct 36 ms 3932 KB Output is correct
54 Correct 40 ms 4564 KB Output is correct
55 Correct 43 ms 4552 KB Output is correct