# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484432 | 2021-11-03T10:46:15 Z | XII | Global Warming (CEOI18_glo) | C++17 | 40 ms | 3960 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; #define fi first #define se second #define mp make_pair #define eb emplace_back #define ALL(x) (x).begin(), (x).end() #define FOR(i, a, b) for(int i = (a); i < (b); ++i) #define FORU(i, a, b) for(int i = (a); i <= (b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define IOS cin.tie(0)->sync_with_stdio(false); #define PROB "CEOI18_glo" void Fi(){ if(fopen(PROB".inp", "r")){ freopen(PROB".inp", "r", stdin); freopen(PROB".out", "w", stdout); } } const int N = 2e5 + 1; int n, x, a[N]; int main(){ IOS; Fi(); cin >> n >> x; vector<int> d0, d1; FORU(i, 1, n){ cin >> a[i]; { int j = lower_bound(ALL(d1), a[i]) - d1.begin(); if(j == d1.size()) d1.eb(a[i]); else d1[j] = min(d1[j], a[i]); } { int j = lower_bound(ALL(d0), a[i]) - d0.begin(); if(j == d0.size()) d0.eb(a[i]); else d0[j] = a[i]; if(j == d1.size()) d1.eb(a[i] - x); else d1[j] = min(d1[j], a[i] - x); // for(int x: d1) cout << x << " "; // cout << "d1\n"; // for(int x: d0) cout << x << " "; // cout << "\n"; } } cout << d1.size(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 324 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 324 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 320 KB | Output is correct |
16 | Correct | 0 ms | 324 KB | Output is correct |
17 | Correct | 0 ms | 296 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 324 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 320 KB | Output is correct |
16 | Correct | 0 ms | 324 KB | Output is correct |
17 | Correct | 0 ms | 296 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 0 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 0 ms | 332 KB | Output is correct |
24 | Correct | 0 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 1076 KB | Output is correct |
2 | Correct | 39 ms | 3012 KB | Output is correct |
3 | Correct | 35 ms | 2924 KB | Output is correct |
4 | Correct | 33 ms | 3016 KB | Output is correct |
5 | Correct | 22 ms | 3228 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 460 KB | Output is correct |
2 | Correct | 9 ms | 976 KB | Output is correct |
3 | Correct | 9 ms | 972 KB | Output is correct |
4 | Correct | 6 ms | 1100 KB | Output is correct |
5 | Correct | 0 ms | 324 KB | Output is correct |
6 | Correct | 7 ms | 1100 KB | Output is correct |
7 | Correct | 7 ms | 972 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 704 KB | Output is correct |
2 | Correct | 18 ms | 1616 KB | Output is correct |
3 | Correct | 38 ms | 3016 KB | Output is correct |
4 | Correct | 22 ms | 3276 KB | Output is correct |
5 | Correct | 12 ms | 1840 KB | Output is correct |
6 | Correct | 21 ms | 3136 KB | Output is correct |
7 | Correct | 23 ms | 3768 KB | Output is correct |
8 | Correct | 15 ms | 1700 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 324 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 320 KB | Output is correct |
16 | Correct | 0 ms | 324 KB | Output is correct |
17 | Correct | 0 ms | 296 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 0 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 0 ms | 332 KB | Output is correct |
24 | Correct | 0 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 33 ms | 1076 KB | Output is correct |
28 | Correct | 39 ms | 3012 KB | Output is correct |
29 | Correct | 35 ms | 2924 KB | Output is correct |
30 | Correct | 33 ms | 3016 KB | Output is correct |
31 | Correct | 22 ms | 3228 KB | Output is correct |
32 | Correct | 8 ms | 460 KB | Output is correct |
33 | Correct | 9 ms | 976 KB | Output is correct |
34 | Correct | 9 ms | 972 KB | Output is correct |
35 | Correct | 6 ms | 1100 KB | Output is correct |
36 | Correct | 0 ms | 324 KB | Output is correct |
37 | Correct | 7 ms | 1100 KB | Output is correct |
38 | Correct | 7 ms | 972 KB | Output is correct |
39 | Correct | 20 ms | 704 KB | Output is correct |
40 | Correct | 18 ms | 1616 KB | Output is correct |
41 | Correct | 38 ms | 3016 KB | Output is correct |
42 | Correct | 22 ms | 3276 KB | Output is correct |
43 | Correct | 12 ms | 1840 KB | Output is correct |
44 | Correct | 21 ms | 3136 KB | Output is correct |
45 | Correct | 23 ms | 3768 KB | Output is correct |
46 | Correct | 15 ms | 1700 KB | Output is correct |
47 | Correct | 22 ms | 1672 KB | Output is correct |
48 | Correct | 16 ms | 1612 KB | Output is correct |
49 | Correct | 40 ms | 2964 KB | Output is correct |
50 | Correct | 22 ms | 3264 KB | Output is correct |
51 | Correct | 22 ms | 3172 KB | Output is correct |
52 | Correct | 25 ms | 3240 KB | Output is correct |
53 | Correct | 25 ms | 3280 KB | Output is correct |
54 | Correct | 24 ms | 3960 KB | Output is correct |
55 | Correct | 34 ms | 2988 KB | Output is correct |