답안 #739522

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739522 2023-05-10T15:03:25 Z Dan4Life Global Warming (CEOI18_glo) C++17
100 / 100
56 ms 2400 KB
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(),a.end()
const int mxN = (int)2e5+10;
int n, x, a[mxN], l[mxN];
vector<int> v;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> x; int ans = 0;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) {
        auto itr = lower_bound(all(v),a[i]);
        l[i] = itr-begin(v)+1; ans = max(ans, l[i]);
        if (itr!=end(v)) *itr = a[i];
        else v.push_back(a[i]);
    }
    v.clear();
    for(int i = n-1; i >= 0; i--){ a[i]=-a[i]-x;
        auto itr = lower_bound(all(v),a[i]);
        int xd = lower_bound(all(v),a[i]+x)-begin(v);
        ans = max(ans, l[i]+xd);
        if (itr!=end(v)) *itr = a[i];
        else v.push_back(a[i]);
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 0 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 1812 KB Output is correct
2 Correct 46 ms 1876 KB Output is correct
3 Correct 56 ms 1888 KB Output is correct
4 Correct 44 ms 1876 KB Output is correct
5 Correct 31 ms 2380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 724 KB Output is correct
2 Correct 11 ms 732 KB Output is correct
3 Correct 10 ms 728 KB Output is correct
4 Correct 7 ms 852 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 8 ms 844 KB Output is correct
7 Correct 9 ms 692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1088 KB Output is correct
2 Correct 26 ms 1160 KB Output is correct
3 Correct 42 ms 1848 KB Output is correct
4 Correct 26 ms 2388 KB Output is correct
5 Correct 13 ms 1368 KB Output is correct
6 Correct 32 ms 2292 KB Output is correct
7 Correct 43 ms 2332 KB Output is correct
8 Correct 17 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 0 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 46 ms 1812 KB Output is correct
28 Correct 46 ms 1876 KB Output is correct
29 Correct 56 ms 1888 KB Output is correct
30 Correct 44 ms 1876 KB Output is correct
31 Correct 31 ms 2380 KB Output is correct
32 Correct 14 ms 724 KB Output is correct
33 Correct 11 ms 732 KB Output is correct
34 Correct 10 ms 728 KB Output is correct
35 Correct 7 ms 852 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 8 ms 844 KB Output is correct
38 Correct 9 ms 692 KB Output is correct
39 Correct 22 ms 1088 KB Output is correct
40 Correct 26 ms 1160 KB Output is correct
41 Correct 42 ms 1848 KB Output is correct
42 Correct 26 ms 2388 KB Output is correct
43 Correct 13 ms 1368 KB Output is correct
44 Correct 32 ms 2292 KB Output is correct
45 Correct 43 ms 2332 KB Output is correct
46 Correct 17 ms 1108 KB Output is correct
47 Correct 22 ms 1076 KB Output is correct
48 Correct 30 ms 1044 KB Output is correct
49 Correct 51 ms 1880 KB Output is correct
50 Correct 47 ms 2320 KB Output is correct
51 Correct 27 ms 1928 KB Output is correct
52 Correct 45 ms 2316 KB Output is correct
53 Correct 34 ms 2384 KB Output is correct
54 Correct 44 ms 2400 KB Output is correct
55 Correct 45 ms 1868 KB Output is correct