답안 #1105822

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1105822 2024-10-28T03:05:41 Z Articulation_points Global Warming (CEOI18_glo) C++14
100 / 100
43 ms 8408 KB
/* Dirty code by Articulation_points */
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int oo=2e18+1;
const int MAXN=2e5;
int n,k,a[MAXN+5],dp[MAXN+5],ans;
vector<int>v;
signed main(){
    cin.tie(0)->sync_with_stdio(false);
    cout.tie(0);
    cin>>n>>k;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    v.push_back(oo);
    for(int i=1;i<=n;++i)
        v.push_back(-oo);
    for(int i=n;i>=1;--i){
        int x=lower_bound(v.begin(),v.end(),a[i],greater<int>())-v.begin();
        ans=max(ans,x);
        dp[i]=x;
        v[x]=a[i];
    }
    v.clear();
    v.push_back(-oo);
    for(int i=1;i<=n;++i)
        v.push_back(oo);
    for(int i=1;i<=n;++i){
        int x=lower_bound(v.begin(),v.end(),a[i]+k)-v.begin();
        ans=max(ans,x+dp[i]-1);
        x=lower_bound(v.begin(),v.end(),a[i])-v.begin();
        v[x]=a[i];
    }
    cout<<ans<<'\n';

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2512 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 1 ms 2384 KB Output is correct
7 Correct 1 ms 2384 KB Output is correct
8 Correct 2 ms 2384 KB Output is correct
9 Correct 1 ms 2384 KB Output is correct
10 Correct 1 ms 2556 KB Output is correct
11 Correct 1 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2512 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 1 ms 2384 KB Output is correct
7 Correct 1 ms 2384 KB Output is correct
8 Correct 2 ms 2384 KB Output is correct
9 Correct 1 ms 2384 KB Output is correct
10 Correct 1 ms 2556 KB Output is correct
11 Correct 1 ms 2384 KB Output is correct
12 Correct 1 ms 2384 KB Output is correct
13 Correct 1 ms 2528 KB Output is correct
14 Correct 1 ms 2384 KB Output is correct
15 Correct 1 ms 2384 KB Output is correct
16 Correct 1 ms 2384 KB Output is correct
17 Correct 1 ms 2384 KB Output is correct
18 Correct 1 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2512 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 1 ms 2384 KB Output is correct
7 Correct 1 ms 2384 KB Output is correct
8 Correct 2 ms 2384 KB Output is correct
9 Correct 1 ms 2384 KB Output is correct
10 Correct 1 ms 2556 KB Output is correct
11 Correct 1 ms 2384 KB Output is correct
12 Correct 1 ms 2384 KB Output is correct
13 Correct 1 ms 2528 KB Output is correct
14 Correct 1 ms 2384 KB Output is correct
15 Correct 1 ms 2384 KB Output is correct
16 Correct 1 ms 2384 KB Output is correct
17 Correct 1 ms 2384 KB Output is correct
18 Correct 1 ms 2384 KB Output is correct
19 Correct 1 ms 2384 KB Output is correct
20 Correct 1 ms 2384 KB Output is correct
21 Correct 1 ms 2608 KB Output is correct
22 Correct 1 ms 2384 KB Output is correct
23 Correct 1 ms 2552 KB Output is correct
24 Correct 1 ms 2384 KB Output is correct
25 Correct 1 ms 2384 KB Output is correct
26 Correct 1 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 8396 KB Output is correct
2 Correct 43 ms 8352 KB Output is correct
3 Correct 41 ms 8396 KB Output is correct
4 Correct 41 ms 8404 KB Output is correct
5 Correct 29 ms 7628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 3540 KB Output is correct
2 Correct 10 ms 3540 KB Output is correct
3 Correct 10 ms 3540 KB Output is correct
4 Correct 9 ms 3284 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 8 ms 3428 KB Output is correct
7 Correct 9 ms 3540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 4560 KB Output is correct
2 Correct 19 ms 4560 KB Output is correct
3 Correct 38 ms 8384 KB Output is correct
4 Correct 31 ms 7628 KB Output is correct
5 Correct 16 ms 4304 KB Output is correct
6 Correct 25 ms 7628 KB Output is correct
7 Correct 29 ms 8180 KB Output is correct
8 Correct 17 ms 4556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2512 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 1 ms 2384 KB Output is correct
7 Correct 1 ms 2384 KB Output is correct
8 Correct 2 ms 2384 KB Output is correct
9 Correct 1 ms 2384 KB Output is correct
10 Correct 1 ms 2556 KB Output is correct
11 Correct 1 ms 2384 KB Output is correct
12 Correct 1 ms 2384 KB Output is correct
13 Correct 1 ms 2528 KB Output is correct
14 Correct 1 ms 2384 KB Output is correct
15 Correct 1 ms 2384 KB Output is correct
16 Correct 1 ms 2384 KB Output is correct
17 Correct 1 ms 2384 KB Output is correct
18 Correct 1 ms 2384 KB Output is correct
19 Correct 1 ms 2384 KB Output is correct
20 Correct 1 ms 2384 KB Output is correct
21 Correct 1 ms 2608 KB Output is correct
22 Correct 1 ms 2384 KB Output is correct
23 Correct 1 ms 2552 KB Output is correct
24 Correct 1 ms 2384 KB Output is correct
25 Correct 1 ms 2384 KB Output is correct
26 Correct 1 ms 2384 KB Output is correct
27 Correct 41 ms 8396 KB Output is correct
28 Correct 43 ms 8352 KB Output is correct
29 Correct 41 ms 8396 KB Output is correct
30 Correct 41 ms 8404 KB Output is correct
31 Correct 29 ms 7628 KB Output is correct
32 Correct 10 ms 3540 KB Output is correct
33 Correct 10 ms 3540 KB Output is correct
34 Correct 10 ms 3540 KB Output is correct
35 Correct 9 ms 3284 KB Output is correct
36 Correct 1 ms 2384 KB Output is correct
37 Correct 8 ms 3428 KB Output is correct
38 Correct 9 ms 3540 KB Output is correct
39 Correct 19 ms 4560 KB Output is correct
40 Correct 19 ms 4560 KB Output is correct
41 Correct 38 ms 8384 KB Output is correct
42 Correct 31 ms 7628 KB Output is correct
43 Correct 16 ms 4304 KB Output is correct
44 Correct 25 ms 7628 KB Output is correct
45 Correct 29 ms 8180 KB Output is correct
46 Correct 17 ms 4556 KB Output is correct
47 Correct 20 ms 4864 KB Output is correct
48 Correct 20 ms 4560 KB Output is correct
49 Correct 40 ms 8408 KB Output is correct
50 Correct 32 ms 7628 KB Output is correct
51 Correct 25 ms 6860 KB Output is correct
52 Correct 31 ms 7888 KB Output is correct
53 Correct 26 ms 7796 KB Output is correct
54 Correct 31 ms 8396 KB Output is correct
55 Correct 36 ms 8396 KB Output is correct