# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
550006 | 2022-04-17T04:16:59 Z | Tien_Noob | Global Warming (CEOI18_glo) | C++17 | 43 ms | 3808 KB |
//Make CSP great again //Vengeance #include <bits/stdc++.h> #define TASK "TESTCODE" #define Log2(x) 31 - __builtin_clz(x) using namespace std; const int N = 2e5; int dp[2][N + 1], n, x; int res = 0; void read() { cin >> n >> x; for (int i = 1; i <= n; ++ i) { int a; cin >> a; dp[0][i] = dp[1][i] = INT_MAX; int j = lower_bound(dp[1] + 1, dp[1] + i + 1, a) - dp[1]; dp[1][j] = a; res = max(res, j); j = lower_bound(dp[0] + 1, dp[0] + i + 1, a - x) - dp[0]; dp[0][j] = a - x; dp[1][j] = min(dp[1][j], dp[0][j]); } cout << res; } void solve() { } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); if (fopen(TASK".INP", "r")) { freopen(TASK".INP", "r", stdin); //freopen(TASK".OUT", "w", stdout); } int t = 1; bool typetest = false; if (typetest) { cin >> t; } for (int __ = 1; __ <= t; ++ __) { //cout << "Case " << __ << ": "; read(); solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 328 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 328 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 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 | 1 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 | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 328 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 328 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 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 | 1 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 | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 328 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 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 | 340 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 | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 3776 KB | Output is correct |
2 | Correct | 43 ms | 3780 KB | Output is correct |
3 | Correct | 39 ms | 3792 KB | Output is correct |
4 | Correct | 43 ms | 3740 KB | Output is correct |
5 | Correct | 23 ms | 3020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1108 KB | Output is correct |
2 | Correct | 9 ms | 1096 KB | Output is correct |
3 | Correct | 10 ms | 1108 KB | Output is correct |
4 | Correct | 7 ms | 980 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 6 ms | 980 KB | Output is correct |
7 | Correct | 9 ms | 1112 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 2004 KB | Output is correct |
2 | Correct | 22 ms | 1972 KB | Output is correct |
3 | Correct | 41 ms | 3788 KB | Output is correct |
4 | Correct | 23 ms | 3024 KB | Output is correct |
5 | Correct | 16 ms | 1732 KB | Output is correct |
6 | Correct | 26 ms | 2884 KB | Output is correct |
7 | Correct | 29 ms | 3592 KB | Output is correct |
8 | Correct | 17 ms | 2092 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 328 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 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 | 1 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 | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 328 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 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 | 340 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 | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 42 ms | 3776 KB | Output is correct |
28 | Correct | 43 ms | 3780 KB | Output is correct |
29 | Correct | 39 ms | 3792 KB | Output is correct |
30 | Correct | 43 ms | 3740 KB | Output is correct |
31 | Correct | 23 ms | 3020 KB | Output is correct |
32 | Correct | 10 ms | 1108 KB | Output is correct |
33 | Correct | 9 ms | 1096 KB | Output is correct |
34 | Correct | 10 ms | 1108 KB | Output is correct |
35 | Correct | 7 ms | 980 KB | Output is correct |
36 | Correct | 1 ms | 212 KB | Output is correct |
37 | Correct | 6 ms | 980 KB | Output is correct |
38 | Correct | 9 ms | 1112 KB | Output is correct |
39 | Correct | 20 ms | 2004 KB | Output is correct |
40 | Correct | 22 ms | 1972 KB | Output is correct |
41 | Correct | 41 ms | 3788 KB | Output is correct |
42 | Correct | 23 ms | 3024 KB | Output is correct |
43 | Correct | 16 ms | 1732 KB | Output is correct |
44 | Correct | 26 ms | 2884 KB | Output is correct |
45 | Correct | 29 ms | 3592 KB | Output is correct |
46 | Correct | 17 ms | 2092 KB | Output is correct |
47 | Correct | 20 ms | 2036 KB | Output is correct |
48 | Correct | 19 ms | 2036 KB | Output is correct |
49 | Correct | 39 ms | 3720 KB | Output is correct |
50 | Correct | 25 ms | 3024 KB | Output is correct |
51 | Correct | 21 ms | 2328 KB | Output is correct |
52 | Correct | 27 ms | 3020 KB | Output is correct |
53 | Correct | 25 ms | 3128 KB | Output is correct |
54 | Correct | 31 ms | 3772 KB | Output is correct |
55 | Correct | 34 ms | 3808 KB | Output is correct |