# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170006 | 2019-12-23T15:10:52 Z | mhy908 | Global Warming (CEOI18_glo) | C++14 | 89 ms | 5880 KB |
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define F first #define S second using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; const LL llinf=9000000000000000000; const int inf=2000000000; int n, x; int lis[200010], lds[200010], ans, arr[200010]; pair<int, int> change[200010]; int main() { scanf("%d %d", &n, &x); for(int i=1; i<=n; i++){ scanf("%d", &arr[i]); lis[i]=inf; } for(int i=1; i<=n; i++){ int it=lower_bound(lis+1, lis+n+1, arr[i])-lis; change[i]=mp(it, lis[it]); lis[it]=arr[i]; ans=max(ans, it); } for(int i=n; i>=1; i--){ int it=lower_bound(lds+1, lds+n+1, -arr[i])-lds; lds[it]=-arr[i]; lis[change[i].F]=change[i].S; int jt=lower_bound(lis+1, lis+n+1, arr[i]+x)-lis-1; ans=max(ans, it+jt); } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 380 KB | Output is correct |
6 | Correct | 2 ms | 292 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 380 KB | Output is correct |
6 | Correct | 2 ms | 292 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 252 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 348 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 380 KB | Output is correct |
6 | Correct | 2 ms | 292 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 252 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 348 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 2 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 2 ms | 376 KB | Output is correct |
25 | Correct | 2 ms | 376 KB | Output is correct |
26 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 85 ms | 3448 KB | Output is correct |
2 | Correct | 85 ms | 3580 KB | Output is correct |
3 | Correct | 87 ms | 3440 KB | Output is correct |
4 | Correct | 89 ms | 3448 KB | Output is correct |
5 | Correct | 66 ms | 3832 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 1148 KB | Output is correct |
2 | Correct | 21 ms | 1144 KB | Output is correct |
3 | Correct | 21 ms | 1144 KB | Output is correct |
4 | Correct | 17 ms | 1144 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 17 ms | 1296 KB | Output is correct |
7 | Correct | 18 ms | 1144 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 1912 KB | Output is correct |
2 | Correct | 38 ms | 1956 KB | Output is correct |
3 | Correct | 76 ms | 3616 KB | Output is correct |
4 | Correct | 66 ms | 3892 KB | Output is correct |
5 | Correct | 32 ms | 2168 KB | Output is correct |
6 | Correct | 58 ms | 3704 KB | Output is correct |
7 | Correct | 56 ms | 3704 KB | Output is correct |
8 | Correct | 33 ms | 1876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 380 KB | Output is correct |
6 | Correct | 2 ms | 292 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 252 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 348 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 2 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 2 ms | 376 KB | Output is correct |
25 | Correct | 2 ms | 376 KB | Output is correct |
26 | Correct | 2 ms | 376 KB | Output is correct |
27 | Correct | 85 ms | 3448 KB | Output is correct |
28 | Correct | 85 ms | 3580 KB | Output is correct |
29 | Correct | 87 ms | 3440 KB | Output is correct |
30 | Correct | 89 ms | 3448 KB | Output is correct |
31 | Correct | 66 ms | 3832 KB | Output is correct |
32 | Correct | 22 ms | 1148 KB | Output is correct |
33 | Correct | 21 ms | 1144 KB | Output is correct |
34 | Correct | 21 ms | 1144 KB | Output is correct |
35 | Correct | 17 ms | 1144 KB | Output is correct |
36 | Correct | 2 ms | 376 KB | Output is correct |
37 | Correct | 17 ms | 1296 KB | Output is correct |
38 | Correct | 18 ms | 1144 KB | Output is correct |
39 | Correct | 38 ms | 1912 KB | Output is correct |
40 | Correct | 38 ms | 1956 KB | Output is correct |
41 | Correct | 76 ms | 3616 KB | Output is correct |
42 | Correct | 66 ms | 3892 KB | Output is correct |
43 | Correct | 32 ms | 2168 KB | Output is correct |
44 | Correct | 58 ms | 3704 KB | Output is correct |
45 | Correct | 56 ms | 3704 KB | Output is correct |
46 | Correct | 33 ms | 1876 KB | Output is correct |
47 | Correct | 42 ms | 2896 KB | Output is correct |
48 | Correct | 42 ms | 2936 KB | Output is correct |
49 | Correct | 85 ms | 5368 KB | Output is correct |
50 | Correct | 63 ms | 5052 KB | Output is correct |
51 | Correct | 50 ms | 3960 KB | Output is correct |
52 | Correct | 65 ms | 5112 KB | Output is correct |
53 | Correct | 57 ms | 5092 KB | Output is correct |
54 | Correct | 60 ms | 5880 KB | Output is correct |
55 | Correct | 74 ms | 5496 KB | Output is correct |