# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1117497 | 2024-11-23T19:32:03 Z | KALARRY | Global Warming (CEOI18_glo) | C++14 | 60 ms | 7056 KB |
//chockolateman #include<bits/stdc++.h> using namespace std; const long long INF = 1e15; long long N,x,t[200005],suff[200005],dp[200005]; //suff[i] = LIC of the suff i starting with at least t[i-1] - d + 1 int main() { scanf("%lld%lld",&N,&x); for(long long i = 1 ; i <= N ; i++) scanf("%lld",&t[i]); dp[0] = INF; for(long long i = 1 ; i <= N ; i++) dp[i] = - INF; for(long long i = N ; i >= 1 ; i--) { long long pos = 0; for(long long b = N ; b >= 1 ; b/=2) while(pos + b <= N && dp[pos+b] > t[i]) pos += b; dp[pos+1] = max(dp[pos+1],t[i]); pos = 0; for(long long b = N ; b >= 1 ; b/=2) while(pos + b <= N && dp[pos+b] > t[i-1] - x) pos += b; suff[i] = pos; } long long ans = 0; for(long long i = 1 ; i <= N ; i++) dp[i] = INF; dp[0] = 0; for(long long i = 1 ; i <= N ; i++) { long long pos = lower_bound(dp,dp+N+1,t[i]) - dp - 1; dp[pos+1] = min(dp[pos+1],t[i]); ans = max(ans,pos+1 + suff[i+1]); } printf("%lld\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | Output is correct |
2 | Correct | 1 ms | 4432 KB | Output is correct |
3 | Correct | 1 ms | 4448 KB | Output is correct |
4 | Correct | 1 ms | 4432 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 1 ms | 4556 KB | Output is correct |
7 | Correct | 2 ms | 4444 KB | Output is correct |
8 | Correct | 2 ms | 4432 KB | Output is correct |
9 | Correct | 2 ms | 4432 KB | Output is correct |
10 | Correct | 1 ms | 4432 KB | Output is correct |
11 | Correct | 2 ms | 4432 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | Output is correct |
2 | Correct | 1 ms | 4432 KB | Output is correct |
3 | Correct | 1 ms | 4448 KB | Output is correct |
4 | Correct | 1 ms | 4432 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 1 ms | 4556 KB | Output is correct |
7 | Correct | 2 ms | 4444 KB | Output is correct |
8 | Correct | 2 ms | 4432 KB | Output is correct |
9 | Correct | 2 ms | 4432 KB | Output is correct |
10 | Correct | 1 ms | 4432 KB | Output is correct |
11 | Correct | 2 ms | 4432 KB | Output is correct |
12 | Correct | 1 ms | 4432 KB | Output is correct |
13 | Correct | 1 ms | 4432 KB | Output is correct |
14 | Correct | 2 ms | 4432 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 2 ms | 4432 KB | Output is correct |
17 | Correct | 1 ms | 4432 KB | Output is correct |
18 | Correct | 1 ms | 4432 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | Output is correct |
2 | Correct | 1 ms | 4432 KB | Output is correct |
3 | Correct | 1 ms | 4448 KB | Output is correct |
4 | Correct | 1 ms | 4432 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 1 ms | 4556 KB | Output is correct |
7 | Correct | 2 ms | 4444 KB | Output is correct |
8 | Correct | 2 ms | 4432 KB | Output is correct |
9 | Correct | 2 ms | 4432 KB | Output is correct |
10 | Correct | 1 ms | 4432 KB | Output is correct |
11 | Correct | 2 ms | 4432 KB | Output is correct |
12 | Correct | 1 ms | 4432 KB | Output is correct |
13 | Correct | 1 ms | 4432 KB | Output is correct |
14 | Correct | 2 ms | 4432 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 2 ms | 4432 KB | Output is correct |
17 | Correct | 1 ms | 4432 KB | Output is correct |
18 | Correct | 1 ms | 4432 KB | Output is correct |
19 | Correct | 1 ms | 4432 KB | Output is correct |
20 | Correct | 1 ms | 4432 KB | Output is correct |
21 | Correct | 2 ms | 4432 KB | Output is correct |
22 | Correct | 2 ms | 4432 KB | Output is correct |
23 | Correct | 1 ms | 4432 KB | Output is correct |
24 | Correct | 1 ms | 4432 KB | Output is correct |
25 | Correct | 2 ms | 4432 KB | Output is correct |
26 | Correct | 1 ms | 4432 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 6992 KB | Output is correct |
2 | Correct | 50 ms | 7056 KB | Output is correct |
3 | Correct | 60 ms | 6992 KB | Output is correct |
4 | Correct | 54 ms | 7056 KB | Output is correct |
5 | Correct | 38 ms | 6288 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 5200 KB | Output is correct |
2 | Correct | 12 ms | 5200 KB | Output is correct |
3 | Correct | 12 ms | 5200 KB | Output is correct |
4 | Correct | 10 ms | 5020 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 10 ms | 4908 KB | Output is correct |
7 | Correct | 10 ms | 5200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 5680 KB | Output is correct |
2 | Correct | 22 ms | 5456 KB | Output is correct |
3 | Correct | 46 ms | 6832 KB | Output is correct |
4 | Correct | 36 ms | 6224 KB | Output is correct |
5 | Correct | 19 ms | 5200 KB | Output is correct |
6 | Correct | 33 ms | 6224 KB | Output is correct |
7 | Correct | 36 ms | 6736 KB | Output is correct |
8 | Correct | 20 ms | 5712 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | Output is correct |
2 | Correct | 1 ms | 4432 KB | Output is correct |
3 | Correct | 1 ms | 4448 KB | Output is correct |
4 | Correct | 1 ms | 4432 KB | Output is correct |
5 | Correct | 1 ms | 4432 KB | Output is correct |
6 | Correct | 1 ms | 4556 KB | Output is correct |
7 | Correct | 2 ms | 4444 KB | Output is correct |
8 | Correct | 2 ms | 4432 KB | Output is correct |
9 | Correct | 2 ms | 4432 KB | Output is correct |
10 | Correct | 1 ms | 4432 KB | Output is correct |
11 | Correct | 2 ms | 4432 KB | Output is correct |
12 | Correct | 1 ms | 4432 KB | Output is correct |
13 | Correct | 1 ms | 4432 KB | Output is correct |
14 | Correct | 2 ms | 4432 KB | Output is correct |
15 | Correct | 1 ms | 4444 KB | Output is correct |
16 | Correct | 2 ms | 4432 KB | Output is correct |
17 | Correct | 1 ms | 4432 KB | Output is correct |
18 | Correct | 1 ms | 4432 KB | Output is correct |
19 | Correct | 1 ms | 4432 KB | Output is correct |
20 | Correct | 1 ms | 4432 KB | Output is correct |
21 | Correct | 2 ms | 4432 KB | Output is correct |
22 | Correct | 2 ms | 4432 KB | Output is correct |
23 | Correct | 1 ms | 4432 KB | Output is correct |
24 | Correct | 1 ms | 4432 KB | Output is correct |
25 | Correct | 2 ms | 4432 KB | Output is correct |
26 | Correct | 1 ms | 4432 KB | Output is correct |
27 | Correct | 50 ms | 6992 KB | Output is correct |
28 | Correct | 50 ms | 7056 KB | Output is correct |
29 | Correct | 60 ms | 6992 KB | Output is correct |
30 | Correct | 54 ms | 7056 KB | Output is correct |
31 | Correct | 38 ms | 6288 KB | Output is correct |
32 | Correct | 13 ms | 5200 KB | Output is correct |
33 | Correct | 12 ms | 5200 KB | Output is correct |
34 | Correct | 12 ms | 5200 KB | Output is correct |
35 | Correct | 10 ms | 5020 KB | Output is correct |
36 | Correct | 1 ms | 4432 KB | Output is correct |
37 | Correct | 10 ms | 4908 KB | Output is correct |
38 | Correct | 10 ms | 5200 KB | Output is correct |
39 | Correct | 30 ms | 5680 KB | Output is correct |
40 | Correct | 22 ms | 5456 KB | Output is correct |
41 | Correct | 46 ms | 6832 KB | Output is correct |
42 | Correct | 36 ms | 6224 KB | Output is correct |
43 | Correct | 19 ms | 5200 KB | Output is correct |
44 | Correct | 33 ms | 6224 KB | Output is correct |
45 | Correct | 36 ms | 6736 KB | Output is correct |
46 | Correct | 20 ms | 5712 KB | Output is correct |
47 | Correct | 24 ms | 5552 KB | Output is correct |
48 | Correct | 24 ms | 5472 KB | Output is correct |
49 | Correct | 49 ms | 6992 KB | Output is correct |
50 | Correct | 38 ms | 6224 KB | Output is correct |
51 | Correct | 33 ms | 5456 KB | Output is correct |
52 | Correct | 38 ms | 6192 KB | Output is correct |
53 | Correct | 34 ms | 6224 KB | Output is correct |
54 | Correct | 37 ms | 6992 KB | Output is correct |
55 | Correct | 46 ms | 6992 KB | Output is correct |