# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
593738 |
2022-07-11T14:16:47 Z |
Vanilla |
Wall (IOI14_wall) |
C++17 |
|
609 ms |
69608 KB |
#include <bits/stdc++.h>
#include "wall.h"
using namespace std;const int maxn = 2e6 + 1;pair <int, int> sgt[maxn * 4];void merge (int x, int mn2, int mx2) {sgt[x].first = min(sgt[x].first, mn2);sgt[x].second = max(min(mn2, sgt[x].second), mx2);}void propagate (int x) {merge(x * 2, sgt[x].first, sgt[x].second);merge(x * 2 + 1, sgt[x].first, sgt[x].second);sgt[x] = {1e6, 0};}int a,b;void upd (int x, int l, int r, int il, int ir, int h, int op) {if (l > ir || r < il) return;if (il <= l && r <= ir) {if (op == 1) merge(x, 1e6, h);else merge(x, h, 0);return;}propagate(x);int mid = (l + r) / 2;upd(x * 2, l, mid, il, ir, h, op);upd(x * 2 + 1, mid + 1, r, il, ir, h, op);}void get (int x, int l, int r, int a[]){if (l > r) return;if (l == r) {a[l] = sgt[x].second;return;}propagate(x);int mid = (l + r) / 2;get(x * 2, l, mid, a);get(x * 2 + 1, mid + 1, r, a);}void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){swap(a,b);for (int i = 0; i < k; i++){upd(1, 0, n-1, left[i], right[i], height[i], op[i]);}get(1, 0, n-1, finalHeight);return;}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
724 KB |
Output is correct |
5 |
Correct |
4 ms |
724 KB |
Output is correct |
6 |
Correct |
4 ms |
724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
122 ms |
13904 KB |
Output is correct |
3 |
Correct |
133 ms |
7956 KB |
Output is correct |
4 |
Correct |
383 ms |
19792 KB |
Output is correct |
5 |
Correct |
258 ms |
20684 KB |
Output is correct |
6 |
Correct |
231 ms |
19120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
828 KB |
Output is correct |
5 |
Correct |
5 ms |
724 KB |
Output is correct |
6 |
Correct |
4 ms |
724 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
130 ms |
13832 KB |
Output is correct |
9 |
Correct |
142 ms |
8092 KB |
Output is correct |
10 |
Correct |
363 ms |
19696 KB |
Output is correct |
11 |
Correct |
232 ms |
20752 KB |
Output is correct |
12 |
Correct |
240 ms |
19160 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
123 ms |
13956 KB |
Output is correct |
15 |
Correct |
22 ms |
1920 KB |
Output is correct |
16 |
Correct |
389 ms |
20024 KB |
Output is correct |
17 |
Correct |
228 ms |
19372 KB |
Output is correct |
18 |
Correct |
227 ms |
19272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
724 KB |
Output is correct |
5 |
Correct |
4 ms |
724 KB |
Output is correct |
6 |
Correct |
5 ms |
704 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
133 ms |
13828 KB |
Output is correct |
9 |
Correct |
133 ms |
7884 KB |
Output is correct |
10 |
Correct |
366 ms |
19800 KB |
Output is correct |
11 |
Correct |
238 ms |
20704 KB |
Output is correct |
12 |
Correct |
221 ms |
19056 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
154 ms |
13900 KB |
Output is correct |
15 |
Correct |
21 ms |
1936 KB |
Output is correct |
16 |
Correct |
352 ms |
19932 KB |
Output is correct |
17 |
Correct |
237 ms |
19360 KB |
Output is correct |
18 |
Correct |
229 ms |
19308 KB |
Output is correct |
19 |
Correct |
579 ms |
68812 KB |
Output is correct |
20 |
Correct |
572 ms |
66976 KB |
Output is correct |
21 |
Correct |
552 ms |
69536 KB |
Output is correct |
22 |
Correct |
572 ms |
67008 KB |
Output is correct |
23 |
Correct |
574 ms |
67032 KB |
Output is correct |
24 |
Correct |
547 ms |
67016 KB |
Output is correct |
25 |
Correct |
609 ms |
67112 KB |
Output is correct |
26 |
Correct |
563 ms |
69568 KB |
Output is correct |
27 |
Correct |
545 ms |
69608 KB |
Output is correct |
28 |
Correct |
577 ms |
66920 KB |
Output is correct |
29 |
Correct |
569 ms |
66904 KB |
Output is correct |
30 |
Correct |
554 ms |
67020 KB |
Output is correct |