# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1043488 |
2024-08-04T10:04:48 Z |
deera |
벽 (IOI14_wall) |
C++14 |
|
399 ms |
78932 KB |
#include <bits/stdc++.h>
using namespace std;
#define cint const int
class Tree {
public :
cint N;
vector<pair<int, int>> tree;
Tree(cint n) : N(n) {
tree.resize(4 * n, {0, INT_MAX});
}
void push(cint x, cint l, cint r) {
if(l == r) {
return;
}
int _l = x * 2;
int _r = x * 2 + 1;
laze(_l, 1, tree[x].first);
laze(_l, 2, tree[x].second);
laze(_r, 1, tree[x].first);
laze(_r, 2, tree[x].second);
tree[x] = {0, INT_MAX};
}
void laze(cint x, cint op, cint v) {
if(op == 1) {
tree[x].first = max(tree[x].first, v);
tree[x].second = max(tree[x].second, tree[x].first);
} else {
tree[x].second = min(tree[x].second, v);
tree[x].first = min(tree[x].first, tree[x].second);
}
}
void update(cint x, cint l, cint r, cint a, cint b, cint op, cint v) {
if(r < a || b < l) return;
if(a <= l && r <= b) {
laze(x, op, v);
} else {
push(x, l, r);
int m = (l + r) / 2;
update(x * 2, l, m, a, b, op, v);
update(x * 2 + 1, m + 1, r, a, b, op, v);
}
}
void output(cint x, cint l, cint r, int results[]) {
if(l == r) {
results[l] = tree[x].first;
return;
}
push(x, l, r);
int m = (l + r) / 2;
output(x * 2, l, m, results);
output(x * 2 + 1, m + 1, r, results);
}
};
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]) {
Tree tree(n);
for(int i = 0; i < k; i++) {
tree.update(1, 0, n - 1, left[i], right[i], op[i], height[i]);
}
tree.output(1, 0, n - 1, finalHeight);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
860 KB |
Output is correct |
5 |
Correct |
3 ms |
860 KB |
Output is correct |
6 |
Correct |
3 ms |
860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
69 ms |
8100 KB |
Output is correct |
3 |
Correct |
84 ms |
4312 KB |
Output is correct |
4 |
Correct |
250 ms |
11600 KB |
Output is correct |
5 |
Correct |
155 ms |
11604 KB |
Output is correct |
6 |
Correct |
148 ms |
11600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
860 KB |
Output is correct |
5 |
Correct |
2 ms |
860 KB |
Output is correct |
6 |
Correct |
2 ms |
860 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
65 ms |
8020 KB |
Output is correct |
9 |
Correct |
85 ms |
4180 KB |
Output is correct |
10 |
Correct |
262 ms |
11540 KB |
Output is correct |
11 |
Correct |
181 ms |
11544 KB |
Output is correct |
12 |
Correct |
178 ms |
11600 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
78 ms |
8084 KB |
Output is correct |
15 |
Correct |
14 ms |
1288 KB |
Output is correct |
16 |
Correct |
254 ms |
11568 KB |
Output is correct |
17 |
Correct |
158 ms |
11572 KB |
Output is correct |
18 |
Correct |
150 ms |
11604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
5 |
Correct |
2 ms |
860 KB |
Output is correct |
6 |
Correct |
2 ms |
860 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
73 ms |
8028 KB |
Output is correct |
9 |
Correct |
92 ms |
4180 KB |
Output is correct |
10 |
Correct |
237 ms |
11604 KB |
Output is correct |
11 |
Correct |
192 ms |
11604 KB |
Output is correct |
12 |
Correct |
149 ms |
11600 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
71 ms |
8272 KB |
Output is correct |
15 |
Correct |
13 ms |
1368 KB |
Output is correct |
16 |
Correct |
249 ms |
11772 KB |
Output is correct |
17 |
Correct |
155 ms |
11600 KB |
Output is correct |
18 |
Correct |
148 ms |
11600 KB |
Output is correct |
19 |
Correct |
375 ms |
78712 KB |
Output is correct |
20 |
Correct |
364 ms |
78500 KB |
Output is correct |
21 |
Correct |
399 ms |
78676 KB |
Output is correct |
22 |
Correct |
340 ms |
78676 KB |
Output is correct |
23 |
Correct |
369 ms |
78576 KB |
Output is correct |
24 |
Correct |
340 ms |
78580 KB |
Output is correct |
25 |
Correct |
347 ms |
78576 KB |
Output is correct |
26 |
Correct |
344 ms |
78676 KB |
Output is correct |
27 |
Correct |
354 ms |
78676 KB |
Output is correct |
28 |
Correct |
356 ms |
78672 KB |
Output is correct |
29 |
Correct |
345 ms |
78672 KB |
Output is correct |
30 |
Correct |
364 ms |
78932 KB |
Output is correct |