#include <cstdio>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;
int* res;
struct segtree{
pi tree[4200000];
void upload(int op, int p, int v){
if(op == 1){
tree[p].first = max(tree[p].first,v);
tree[p].second = max(tree[p].second,v);
}
else{
tree[p].first = min(tree[p].first,v);
tree[p].second = min(tree[p].second,v);
}
}
void insert(int s, int e, int p, int ps, int pe, int v, int op){
if(pe < s || e < ps) return;
if(s <= ps && pe <= e){
upload(op,p,v);
res[s] = tree[p].first;
}
else{
upload(1,2*p,tree[p].first);
upload(2,2*p,tree[p].second);
upload(1,2*p+1,tree[p].first);
upload(2,2*p+1,tree[p].second);
tree[p].first = 0;
tree[p].second = 1e5 + 5;
int pm = (ps+pe)/2;
insert(s,e,2*p,ps,pm,v,op);
insert(s,e,2*p+1,pm+1,pe,v,op);
}
}
}seg;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
res = finalHeight;
for (int i=0; i<k; i++) {
seg.insert(left[i],right[i],1,0,n-1,height[i],op[i]);
}
for (int i=0; i<n; i++) {
seg.insert(i,i,1,0,n-1,0,1);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
33900 KB |
Output is correct |
2 |
Correct |
12 ms |
33900 KB |
Output is correct |
3 |
Correct |
8 ms |
33900 KB |
Output is correct |
4 |
Correct |
16 ms |
33900 KB |
Output is correct |
5 |
Correct |
16 ms |
33900 KB |
Output is correct |
6 |
Correct |
8 ms |
33900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
33900 KB |
Output is correct |
2 |
Correct |
184 ms |
41724 KB |
Output is correct |
3 |
Correct |
208 ms |
37148 KB |
Output is correct |
4 |
Correct |
604 ms |
42116 KB |
Output is correct |
5 |
Correct |
368 ms |
42116 KB |
Output is correct |
6 |
Correct |
360 ms |
42116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
33900 KB |
Output is correct |
2 |
Correct |
8 ms |
33900 KB |
Output is correct |
3 |
Correct |
8 ms |
33900 KB |
Output is correct |
4 |
Correct |
16 ms |
33900 KB |
Output is correct |
5 |
Correct |
8 ms |
33900 KB |
Output is correct |
6 |
Correct |
20 ms |
33900 KB |
Output is correct |
7 |
Correct |
8 ms |
33900 KB |
Output is correct |
8 |
Correct |
180 ms |
41724 KB |
Output is correct |
9 |
Correct |
204 ms |
37148 KB |
Output is correct |
10 |
Correct |
608 ms |
42116 KB |
Output is correct |
11 |
Correct |
392 ms |
42116 KB |
Output is correct |
12 |
Correct |
364 ms |
42116 KB |
Output is correct |
13 |
Correct |
0 ms |
33900 KB |
Output is correct |
14 |
Correct |
184 ms |
41724 KB |
Output is correct |
15 |
Correct |
44 ms |
34384 KB |
Output is correct |
16 |
Correct |
592 ms |
42116 KB |
Output is correct |
17 |
Correct |
380 ms |
42116 KB |
Output is correct |
18 |
Correct |
376 ms |
42116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
33900 KB |
Output is correct |
2 |
Correct |
4 ms |
33900 KB |
Output is correct |
3 |
Correct |
0 ms |
33900 KB |
Output is correct |
4 |
Correct |
20 ms |
33900 KB |
Output is correct |
5 |
Correct |
16 ms |
33900 KB |
Output is correct |
6 |
Correct |
8 ms |
33900 KB |
Output is correct |
7 |
Correct |
4 ms |
33900 KB |
Output is correct |
8 |
Correct |
188 ms |
41724 KB |
Output is correct |
9 |
Correct |
208 ms |
37148 KB |
Output is correct |
10 |
Correct |
608 ms |
42116 KB |
Output is correct |
11 |
Correct |
392 ms |
42116 KB |
Output is correct |
12 |
Correct |
356 ms |
42116 KB |
Output is correct |
13 |
Correct |
8 ms |
33900 KB |
Output is correct |
14 |
Correct |
172 ms |
41724 KB |
Output is correct |
15 |
Correct |
44 ms |
34384 KB |
Output is correct |
16 |
Correct |
604 ms |
42116 KB |
Output is correct |
17 |
Correct |
376 ms |
42116 KB |
Output is correct |
18 |
Correct |
340 ms |
42116 KB |
Output is correct |
19 |
Correct |
1372 ms |
49540 KB |
Output is correct |
20 |
Correct |
1376 ms |
49540 KB |
Output is correct |
21 |
Correct |
1372 ms |
49540 KB |
Output is correct |
22 |
Correct |
1344 ms |
49540 KB |
Output is correct |
23 |
Correct |
1376 ms |
49540 KB |
Output is correct |
24 |
Correct |
1400 ms |
49540 KB |
Output is correct |
25 |
Correct |
1380 ms |
49540 KB |
Output is correct |
26 |
Correct |
1408 ms |
49540 KB |
Output is correct |
27 |
Correct |
1388 ms |
49540 KB |
Output is correct |
28 |
Correct |
1392 ms |
49540 KB |
Output is correct |
29 |
Correct |
1384 ms |
49540 KB |
Output is correct |
30 |
Correct |
1408 ms |
49540 KB |
Output is correct |