# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1097847 |
2024-10-08T10:39:22 Z |
esomer |
벽 (IOI14_wall) |
C++17 |
|
706 ms |
59420 KB |
#include<bits/stdc++.h>
using namespace std;
struct segTree{
vector<pair<int, int>> v;
int siz;
void init(int n){
siz = 1;
while(siz < n) siz *= 2;
v.assign(2 * siz, {0, 0});
}
void push(int x){
v[2 * x + 1].first = min(max(v[2 * x + 1].first, v[x].first), v[x].second);
v[2 * x + 1].second = max(min(v[2 * x + 1].second, v[x].second), v[x].first);
v[2 * x + 2].first = min(max(v[2 * x + 2].first, v[x].first), v[x].second);
v[2 * x + 2].second = max(min(v[2 * x + 2].second, v[x].second), v[x].first);
}
void set(int l, int r, int x, int lx, int rx, int h, int t){
if(lx >= l && rx <= r){
if(t == 1){
v[x].first = max(v[x].first, h);
v[x].second = max(v[x].second, v[x].first);
}else{
v[x].second = min(v[x].second, h);
v[x].first = min(v[x].first, v[x].second);
}
return;
}else if(lx >= r || rx <= l) return;
push(x);
v[x] = {0, 100000};
int m = (lx + rx) / 2;
set(l, r, 2 * x + 1, lx, m, h, t);
set(l, r, 2 * x + 2, m, rx, h, t);
}
void set(int l, int r, int h, int t){
set(l, r, 0, 0, siz, h, t);
}
int calc(int i, int x, int lx, int rx){
if(rx - lx == 1){
return v[x].first;
}
push(x);
v[x] = {0, 100000};
int m = (lx + rx) / 2;
if(i < m) return calc(i, 2 * x + 1, lx, m);
else return calc(i, 2 * x + 2, m, rx);
}
int calc(int i){
return calc(i, 0, 0, siz);
}
};
void buildWall(int n, int k, int* op, int* left, int* right, int* height, int* finalHeight){
segTree st; st.init(n);
for(int i = 0; i < k; i++){
st.set(left[i], right[i] + 1, height[i], op[i]);
}
for(int i = 0; i < n; i++){
finalHeight[i] = st.calc(i);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
428 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
5 ms |
852 KB |
Output is correct |
5 |
Correct |
4 ms |
860 KB |
Output is correct |
6 |
Correct |
4 ms |
860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
91 ms |
14032 KB |
Output is correct |
3 |
Correct |
114 ms |
7832 KB |
Output is correct |
4 |
Correct |
310 ms |
20136 KB |
Output is correct |
5 |
Correct |
200 ms |
20820 KB |
Output is correct |
6 |
Correct |
204 ms |
19076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
5 ms |
896 KB |
Output is correct |
5 |
Correct |
4 ms |
708 KB |
Output is correct |
6 |
Correct |
6 ms |
860 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
81 ms |
14096 KB |
Output is correct |
9 |
Correct |
125 ms |
8020 KB |
Output is correct |
10 |
Correct |
306 ms |
20220 KB |
Output is correct |
11 |
Correct |
202 ms |
20820 KB |
Output is correct |
12 |
Correct |
196 ms |
19284 KB |
Output is correct |
13 |
Correct |
1 ms |
432 KB |
Output is correct |
14 |
Correct |
85 ms |
13888 KB |
Output is correct |
15 |
Correct |
21 ms |
1880 KB |
Output is correct |
16 |
Correct |
360 ms |
20084 KB |
Output is correct |
17 |
Correct |
196 ms |
19540 KB |
Output is correct |
18 |
Correct |
199 ms |
19796 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 |
392 KB |
Output is correct |
4 |
Correct |
5 ms |
888 KB |
Output is correct |
5 |
Correct |
4 ms |
860 KB |
Output is correct |
6 |
Correct |
4 ms |
704 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
90 ms |
13972 KB |
Output is correct |
9 |
Correct |
128 ms |
7988 KB |
Output is correct |
10 |
Correct |
311 ms |
20308 KB |
Output is correct |
11 |
Correct |
186 ms |
20820 KB |
Output is correct |
12 |
Correct |
190 ms |
19256 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
88 ms |
13964 KB |
Output is correct |
15 |
Correct |
21 ms |
1900 KB |
Output is correct |
16 |
Correct |
352 ms |
20304 KB |
Output is correct |
17 |
Correct |
199 ms |
19536 KB |
Output is correct |
18 |
Correct |
220 ms |
19536 KB |
Output is correct |
19 |
Correct |
687 ms |
59352 KB |
Output is correct |
20 |
Correct |
681 ms |
59144 KB |
Output is correct |
21 |
Correct |
688 ms |
59208 KB |
Output is correct |
22 |
Correct |
706 ms |
59348 KB |
Output is correct |
23 |
Correct |
660 ms |
59420 KB |
Output is correct |
24 |
Correct |
677 ms |
59132 KB |
Output is correct |
25 |
Correct |
660 ms |
59196 KB |
Output is correct |
26 |
Correct |
688 ms |
59304 KB |
Output is correct |
27 |
Correct |
677 ms |
59216 KB |
Output is correct |
28 |
Correct |
697 ms |
59220 KB |
Output is correct |
29 |
Correct |
701 ms |
59220 KB |
Output is correct |
30 |
Correct |
632 ms |
59208 KB |
Output is correct |