# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
52301 |
2018-06-25T08:37:20 Z |
win11905 |
Wall (IOI14_wall) |
C++11 |
|
1010 ms |
239024 KB |
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1<<21, INF = 1e9;
int n, lo[N<<1], hi[N<<1], *ans;
void addtag(int p, int low, int high) {
lo[p] = min(high, max(lo[p], low));
hi[p] = max(low, min(hi[p], high));
}
void push(int p, int l, int r) {
if(l == r) ans[l] = min(max(ans[r], lo[p]), hi[p]);
else {
int m = (l + r) >> 1;
addtag(p<<1, lo[p], hi[p]);
addtag(p<<1|1, lo[p], hi[p]);
}
lo[p] = 0;
hi[p] = INF;
}
void update(int x, int y, int lo, int hi, int p = 1, int l = 0, int r = n-1) {
if(x > r || l > y) return;
if(x <= l && r <= y) return addtag(p, lo, hi);
push(p, l, r);
int m = (l + r) >> 1;
update(x, y, lo, hi, p<<1, l, m), update(x, y, lo, hi, p<<1|1, m+1, r);
}
void build(int p = 1, int l = 0, int r = n-1) {
hi[p] = INF;
if(l == r) return;
int m = (l + r) >> 1;
build(p<<1, l, m), build(p<<1|1, m+1, r);
}
void fin(int p = 1, int l = 0, int r = n-1) {
push(p, l, r);
if(l == r) return;
int m = (l + r) >> 1;
fin(p<<1, l, m), fin(p<<1|1, m+1, r);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
::n = n;
ans = finalHeight;
build();
for(int i = 0; i < k; ++i) {
if(op[i] == 1) update(left[i], right[i], height[i], INF);
else update(left[i], right[i], 0, height[i]);
}
fin();
return;
}
Compilation message
wall.cpp: In function 'void push(int, int, int)':
wall.cpp:17:9: warning: unused variable 'm' [-Wunused-variable]
int m = (l + r) >> 1;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
616 KB |
Output is correct |
3 |
Correct |
4 ms |
616 KB |
Output is correct |
4 |
Correct |
8 ms |
808 KB |
Output is correct |
5 |
Correct |
7 ms |
848 KB |
Output is correct |
6 |
Correct |
8 ms |
992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
992 KB |
Output is correct |
2 |
Correct |
170 ms |
8500 KB |
Output is correct |
3 |
Correct |
249 ms |
8500 KB |
Output is correct |
4 |
Correct |
602 ms |
11016 KB |
Output is correct |
5 |
Correct |
360 ms |
11628 KB |
Output is correct |
6 |
Correct |
347 ms |
11628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
11628 KB |
Output is correct |
2 |
Correct |
4 ms |
11628 KB |
Output is correct |
3 |
Correct |
4 ms |
11628 KB |
Output is correct |
4 |
Correct |
8 ms |
11628 KB |
Output is correct |
5 |
Correct |
11 ms |
11628 KB |
Output is correct |
6 |
Correct |
12 ms |
11628 KB |
Output is correct |
7 |
Correct |
2 ms |
11628 KB |
Output is correct |
8 |
Correct |
193 ms |
11628 KB |
Output is correct |
9 |
Correct |
237 ms |
11628 KB |
Output is correct |
10 |
Correct |
618 ms |
11628 KB |
Output is correct |
11 |
Correct |
421 ms |
11692 KB |
Output is correct |
12 |
Correct |
414 ms |
11692 KB |
Output is correct |
13 |
Correct |
3 ms |
11692 KB |
Output is correct |
14 |
Correct |
193 ms |
11692 KB |
Output is correct |
15 |
Correct |
49 ms |
11692 KB |
Output is correct |
16 |
Correct |
630 ms |
21616 KB |
Output is correct |
17 |
Correct |
364 ms |
30708 KB |
Output is correct |
18 |
Correct |
393 ms |
39752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
39752 KB |
Output is correct |
2 |
Correct |
5 ms |
39752 KB |
Output is correct |
3 |
Correct |
3 ms |
39752 KB |
Output is correct |
4 |
Correct |
9 ms |
39752 KB |
Output is correct |
5 |
Correct |
11 ms |
39752 KB |
Output is correct |
6 |
Correct |
7 ms |
39752 KB |
Output is correct |
7 |
Correct |
2 ms |
39752 KB |
Output is correct |
8 |
Correct |
173 ms |
39752 KB |
Output is correct |
9 |
Correct |
203 ms |
39752 KB |
Output is correct |
10 |
Correct |
610 ms |
39752 KB |
Output is correct |
11 |
Correct |
372 ms |
39940 KB |
Output is correct |
12 |
Correct |
346 ms |
39996 KB |
Output is correct |
13 |
Correct |
2 ms |
39996 KB |
Output is correct |
14 |
Correct |
187 ms |
39996 KB |
Output is correct |
15 |
Correct |
37 ms |
39996 KB |
Output is correct |
16 |
Correct |
615 ms |
50064 KB |
Output is correct |
17 |
Correct |
355 ms |
59220 KB |
Output is correct |
18 |
Correct |
363 ms |
68100 KB |
Output is correct |
19 |
Correct |
806 ms |
126296 KB |
Output is correct |
20 |
Correct |
783 ms |
134328 KB |
Output is correct |
21 |
Correct |
781 ms |
147100 KB |
Output is correct |
22 |
Correct |
897 ms |
155268 KB |
Output is correct |
23 |
Correct |
905 ms |
165808 KB |
Output is correct |
24 |
Correct |
958 ms |
176152 KB |
Output is correct |
25 |
Correct |
1006 ms |
186740 KB |
Output is correct |
26 |
Correct |
885 ms |
199520 KB |
Output is correct |
27 |
Correct |
1010 ms |
210096 KB |
Output is correct |
28 |
Correct |
757 ms |
217884 KB |
Output is correct |
29 |
Correct |
997 ms |
228444 KB |
Output is correct |
30 |
Correct |
792 ms |
239024 KB |
Output is correct |