# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
980765 |
2024-05-12T11:24:29 Z |
Amaarsaa |
Wall (IOI14_wall) |
C++14 |
|
467 ms |
99412 KB |
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define oo 2000000000
const int N = 2000010;
pair<int,int> seg[4 * N];
void update(int s,int e,int idx,int l,int r,int val,bool b){
val = max(val,seg[idx].first);
val = min(val,seg[idx].second);
if(s > r || e < l) return;
if(s >= l && e <= r){
if(!b) seg[idx].first = val; else seg[idx].second = val;
return;
}
update(s,(s+e)/2,idx*2,l,r,val,b);
update((s+e)/2+1,e,idx*2+1,l,r,val,b);
}
void make(int s,int e,int idx,int cur,int *arr){
cur = max(cur,seg[idx].first);
cur = min(cur,seg[idx].second);
if(s == e){
arr[s] = cur;
return;
}
make(s,(s+e)/2,idx*2,cur,arr);
make((s+e)/2+1,e,idx*2+1,cur,arr);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
for(int i=1;i<=4 * n;i++) seg[i] = make_pair(0,oo);
for(int i=k-1;i>=0;i--)
update(0,n-1,1,left[i],right[i],height[i],op[i]-1);
make(0,n-1,1,0,finalHeight);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
2908 KB |
Output is correct |
5 |
Correct |
4 ms |
2908 KB |
Output is correct |
6 |
Correct |
3 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
110 ms |
13944 KB |
Output is correct |
3 |
Correct |
104 ms |
8528 KB |
Output is correct |
4 |
Correct |
316 ms |
22672 KB |
Output is correct |
5 |
Correct |
191 ms |
23636 KB |
Output is correct |
6 |
Correct |
204 ms |
22096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
4 ms |
2696 KB |
Output is correct |
5 |
Correct |
3 ms |
2908 KB |
Output is correct |
6 |
Correct |
4 ms |
2904 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
109 ms |
13948 KB |
Output is correct |
9 |
Correct |
100 ms |
9808 KB |
Output is correct |
10 |
Correct |
274 ms |
22876 KB |
Output is correct |
11 |
Correct |
196 ms |
23732 KB |
Output is correct |
12 |
Correct |
186 ms |
22164 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
113 ms |
13940 KB |
Output is correct |
15 |
Correct |
18 ms |
3676 KB |
Output is correct |
16 |
Correct |
273 ms |
22924 KB |
Output is correct |
17 |
Correct |
196 ms |
22240 KB |
Output is correct |
18 |
Correct |
195 ms |
22220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
2904 KB |
Output is correct |
5 |
Correct |
4 ms |
2696 KB |
Output is correct |
6 |
Correct |
4 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
111 ms |
13912 KB |
Output is correct |
9 |
Correct |
112 ms |
9644 KB |
Output is correct |
10 |
Correct |
288 ms |
22696 KB |
Output is correct |
11 |
Correct |
203 ms |
23788 KB |
Output is correct |
12 |
Correct |
189 ms |
22064 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
112 ms |
13964 KB |
Output is correct |
15 |
Correct |
18 ms |
3672 KB |
Output is correct |
16 |
Correct |
282 ms |
22804 KB |
Output is correct |
17 |
Correct |
191 ms |
22384 KB |
Output is correct |
18 |
Correct |
192 ms |
22356 KB |
Output is correct |
19 |
Correct |
443 ms |
99344 KB |
Output is correct |
20 |
Correct |
422 ms |
96912 KB |
Output is correct |
21 |
Correct |
425 ms |
99196 KB |
Output is correct |
22 |
Correct |
430 ms |
96848 KB |
Output is correct |
23 |
Correct |
427 ms |
96824 KB |
Output is correct |
24 |
Correct |
427 ms |
96864 KB |
Output is correct |
25 |
Correct |
424 ms |
96844 KB |
Output is correct |
26 |
Correct |
427 ms |
99412 KB |
Output is correct |
27 |
Correct |
458 ms |
99236 KB |
Output is correct |
28 |
Correct |
428 ms |
97132 KB |
Output is correct |
29 |
Correct |
425 ms |
96932 KB |
Output is correct |
30 |
Correct |
467 ms |
96960 KB |
Output is correct |