# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144671 | 2019-08-17T11:06:53 Z | neki | Global Warming (CEOI18_glo) | C++14 | 86 ms | 8596 KB |
#include <bits/stdc++.h> #define loop(i, a, b) for(int i=a;i<b;i++) #define maxn 201000 using namespace std; typedef long long ll; ll arr[maxn], fo[maxn], ba[maxn], temp[maxn]; int main(){ int n, x;cin >> n >> x; x=abs(x); loop(i, 0, n) scanf("%lld", &arr[i]); loop(i, 0, maxn) temp[i]=LLONG_MAX;temp[0]=LLONG_MIN; loop(i, 0, n) fo[i]=lower_bound(temp, temp+n, arr[i]+x)-temp, *lower_bound(temp, temp+n, arr[i])=arr[i]; loop(i, 0, maxn) temp[i]=LLONG_MAX;temp[0]=LLONG_MIN; for(int i=n-1;i>=0;i--) ba[i]=lower_bound(temp, temp+n, -arr[i])-temp, temp[ba[i]]=-arr[i]; ll ans=1; loop(i, 0, n) ans=max(ans, fo[i]+ba[i]-1); cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 1912 KB | Output is correct |
3 | Correct | 3 ms | 1912 KB | Output is correct |
4 | Correct | 4 ms | 1912 KB | Output is correct |
5 | Correct | 3 ms | 1912 KB | Output is correct |
6 | Correct | 3 ms | 1912 KB | Output is correct |
7 | Correct | 3 ms | 1912 KB | Output is correct |
8 | Correct | 4 ms | 1912 KB | Output is correct |
9 | Correct | 4 ms | 1916 KB | Output is correct |
10 | Correct | 3 ms | 1912 KB | Output is correct |
11 | Correct | 3 ms | 1912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 1912 KB | Output is correct |
3 | Correct | 3 ms | 1912 KB | Output is correct |
4 | Correct | 4 ms | 1912 KB | Output is correct |
5 | Correct | 3 ms | 1912 KB | Output is correct |
6 | Correct | 3 ms | 1912 KB | Output is correct |
7 | Correct | 3 ms | 1912 KB | Output is correct |
8 | Correct | 4 ms | 1912 KB | Output is correct |
9 | Correct | 4 ms | 1916 KB | Output is correct |
10 | Correct | 3 ms | 1912 KB | Output is correct |
11 | Correct | 3 ms | 1912 KB | Output is correct |
12 | Correct | 3 ms | 1912 KB | Output is correct |
13 | Correct | 3 ms | 1912 KB | Output is correct |
14 | Correct | 3 ms | 1912 KB | Output is correct |
15 | Correct | 3 ms | 1912 KB | Output is correct |
16 | Correct | 3 ms | 1912 KB | Output is correct |
17 | Correct | 4 ms | 1912 KB | Output is correct |
18 | Correct | 3 ms | 1916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 1912 KB | Output is correct |
3 | Correct | 3 ms | 1912 KB | Output is correct |
4 | Correct | 4 ms | 1912 KB | Output is correct |
5 | Correct | 3 ms | 1912 KB | Output is correct |
6 | Correct | 3 ms | 1912 KB | Output is correct |
7 | Correct | 3 ms | 1912 KB | Output is correct |
8 | Correct | 4 ms | 1912 KB | Output is correct |
9 | Correct | 4 ms | 1916 KB | Output is correct |
10 | Correct | 3 ms | 1912 KB | Output is correct |
11 | Correct | 3 ms | 1912 KB | Output is correct |
12 | Correct | 3 ms | 1912 KB | Output is correct |
13 | Correct | 3 ms | 1912 KB | Output is correct |
14 | Correct | 3 ms | 1912 KB | Output is correct |
15 | Correct | 3 ms | 1912 KB | Output is correct |
16 | Correct | 3 ms | 1912 KB | Output is correct |
17 | Correct | 4 ms | 1912 KB | Output is correct |
18 | Correct | 3 ms | 1916 KB | Output is correct |
19 | Correct | 4 ms | 1912 KB | Output is correct |
20 | Correct | 4 ms | 1912 KB | Output is correct |
21 | Correct | 4 ms | 1884 KB | Output is correct |
22 | Correct | 5 ms | 1912 KB | Output is correct |
23 | Correct | 4 ms | 1912 KB | Output is correct |
24 | Correct | 4 ms | 1912 KB | Output is correct |
25 | Correct | 4 ms | 1912 KB | Output is correct |
26 | Correct | 4 ms | 1912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 84 ms | 8528 KB | Output is correct |
2 | Correct | 86 ms | 8588 KB | Output is correct |
3 | Correct | 85 ms | 8556 KB | Output is correct |
4 | Correct | 86 ms | 8568 KB | Output is correct |
5 | Correct | 61 ms | 7780 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 3556 KB | Output is correct |
2 | Correct | 23 ms | 3704 KB | Output is correct |
3 | Correct | 22 ms | 3576 KB | Output is correct |
4 | Correct | 18 ms | 3320 KB | Output is correct |
5 | Correct | 4 ms | 1912 KB | Output is correct |
6 | Correct | 18 ms | 3448 KB | Output is correct |
7 | Correct | 19 ms | 3576 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 5212 KB | Output is correct |
2 | Correct | 39 ms | 5240 KB | Output is correct |
3 | Correct | 76 ms | 8568 KB | Output is correct |
4 | Correct | 68 ms | 7844 KB | Output is correct |
5 | Correct | 34 ms | 4828 KB | Output is correct |
6 | Correct | 52 ms | 7544 KB | Output is correct |
7 | Correct | 56 ms | 8184 KB | Output is correct |
8 | Correct | 34 ms | 5340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 1912 KB | Output is correct |
3 | Correct | 3 ms | 1912 KB | Output is correct |
4 | Correct | 4 ms | 1912 KB | Output is correct |
5 | Correct | 3 ms | 1912 KB | Output is correct |
6 | Correct | 3 ms | 1912 KB | Output is correct |
7 | Correct | 3 ms | 1912 KB | Output is correct |
8 | Correct | 4 ms | 1912 KB | Output is correct |
9 | Correct | 4 ms | 1916 KB | Output is correct |
10 | Correct | 3 ms | 1912 KB | Output is correct |
11 | Correct | 3 ms | 1912 KB | Output is correct |
12 | Correct | 3 ms | 1912 KB | Output is correct |
13 | Correct | 3 ms | 1912 KB | Output is correct |
14 | Correct | 3 ms | 1912 KB | Output is correct |
15 | Correct | 3 ms | 1912 KB | Output is correct |
16 | Correct | 3 ms | 1912 KB | Output is correct |
17 | Correct | 4 ms | 1912 KB | Output is correct |
18 | Correct | 3 ms | 1916 KB | Output is correct |
19 | Correct | 4 ms | 1912 KB | Output is correct |
20 | Correct | 4 ms | 1912 KB | Output is correct |
21 | Correct | 4 ms | 1884 KB | Output is correct |
22 | Correct | 5 ms | 1912 KB | Output is correct |
23 | Correct | 4 ms | 1912 KB | Output is correct |
24 | Correct | 4 ms | 1912 KB | Output is correct |
25 | Correct | 4 ms | 1912 KB | Output is correct |
26 | Correct | 4 ms | 1912 KB | Output is correct |
27 | Correct | 84 ms | 8528 KB | Output is correct |
28 | Correct | 86 ms | 8588 KB | Output is correct |
29 | Correct | 85 ms | 8556 KB | Output is correct |
30 | Correct | 86 ms | 8568 KB | Output is correct |
31 | Correct | 61 ms | 7780 KB | Output is correct |
32 | Correct | 23 ms | 3556 KB | Output is correct |
33 | Correct | 23 ms | 3704 KB | Output is correct |
34 | Correct | 22 ms | 3576 KB | Output is correct |
35 | Correct | 18 ms | 3320 KB | Output is correct |
36 | Correct | 4 ms | 1912 KB | Output is correct |
37 | Correct | 18 ms | 3448 KB | Output is correct |
38 | Correct | 19 ms | 3576 KB | Output is correct |
39 | Correct | 39 ms | 5212 KB | Output is correct |
40 | Correct | 39 ms | 5240 KB | Output is correct |
41 | Correct | 76 ms | 8568 KB | Output is correct |
42 | Correct | 68 ms | 7844 KB | Output is correct |
43 | Correct | 34 ms | 4828 KB | Output is correct |
44 | Correct | 52 ms | 7544 KB | Output is correct |
45 | Correct | 56 ms | 8184 KB | Output is correct |
46 | Correct | 34 ms | 5340 KB | Output is correct |
47 | Correct | 43 ms | 5240 KB | Output is correct |
48 | Correct | 43 ms | 5240 KB | Output is correct |
49 | Correct | 85 ms | 8596 KB | Output is correct |
50 | Correct | 68 ms | 7760 KB | Output is correct |
51 | Correct | 50 ms | 6264 KB | Output is correct |
52 | Correct | 65 ms | 7800 KB | Output is correct |
53 | Correct | 55 ms | 7800 KB | Output is correct |
54 | Correct | 59 ms | 8568 KB | Output is correct |
55 | Correct | 68 ms | 8568 KB | Output is correct |