# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
146227 |
2019-08-22T22:54:18 Z |
Diuven |
Wall (IOI14_wall) |
C++14 |
|
714 ms |
69736 KB |
#include "wall.h"
const int HMX = 100001;
inline int _min(int a, int b){ return a<b ? a : b; }
inline int _max(int a, int b){ return a>b ? a : b; }
struct node {
int up=0, dn=0;
node(){}
node(int a, int b): up(a), dn(b) {}
node operator + (const node& nd) const {
node res = *this;
res.up = _max(res.up, nd.up);
res.dn = _max(res.dn, nd.up);
res.dn = _min(res.dn, nd.dn);
return res;
}
} T[1<<22];
void busy(int v, int s, int e){
if(s==e) return;
node &ndl = T[v*2], &ndr = T[v*2+1], &nd = T[v];
ndl = ndl + nd, ndr = ndr + nd;
nd.up = 0, nd.dn = HMX;
}
void upt(int v, int s, int e, int l, int r, int op, int h){
if(l<=s && e<=r){
T[v] = T[v] + node(op==1 ? h : 0, op==2 ? h : HMX); return;
}
busy(v,s,e);
int m = (s+e)/2;
if(l<=m) upt(v*2,s,m,l,r,op,h);
if(m<r) upt(v*2+1,m+1,e,l,r,op,h);
}
void get(int v, int s, int e, int ans[]){
busy(v,s,e);
if(s==e){ ans[s] = _min(_max(0, T[v].up), T[v].dn); return; }
get(v*2, s, (s+e)/2, ans);
get(v*2+1, (s+e)/2+1, e, ans);
}
void buildWall(int n, int k, int op[], int L[], int R[], int H[], int ans[]){
for(int i=0; i<k; i++) upt(1, 0, n-1, L[i], R[i], op[i], H[i]);
get(1,0,n-1,ans);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
33272 KB |
Output is correct |
2 |
Correct |
32 ms |
33272 KB |
Output is correct |
3 |
Correct |
33 ms |
33272 KB |
Output is correct |
4 |
Correct |
36 ms |
33400 KB |
Output is correct |
5 |
Correct |
35 ms |
33400 KB |
Output is correct |
6 |
Correct |
35 ms |
33400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
33344 KB |
Output is correct |
2 |
Correct |
198 ms |
46812 KB |
Output is correct |
3 |
Correct |
210 ms |
40256 KB |
Output is correct |
4 |
Correct |
540 ms |
51200 KB |
Output is correct |
5 |
Correct |
335 ms |
52216 KB |
Output is correct |
6 |
Correct |
327 ms |
50640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
33272 KB |
Output is correct |
2 |
Correct |
32 ms |
33272 KB |
Output is correct |
3 |
Correct |
31 ms |
33244 KB |
Output is correct |
4 |
Correct |
36 ms |
33404 KB |
Output is correct |
5 |
Correct |
35 ms |
33400 KB |
Output is correct |
6 |
Correct |
35 ms |
33400 KB |
Output is correct |
7 |
Correct |
36 ms |
33212 KB |
Output is correct |
8 |
Correct |
199 ms |
46812 KB |
Output is correct |
9 |
Correct |
211 ms |
40312 KB |
Output is correct |
10 |
Correct |
548 ms |
51320 KB |
Output is correct |
11 |
Correct |
339 ms |
52256 KB |
Output is correct |
12 |
Correct |
318 ms |
50680 KB |
Output is correct |
13 |
Correct |
30 ms |
33144 KB |
Output is correct |
14 |
Correct |
228 ms |
46812 KB |
Output is correct |
15 |
Correct |
60 ms |
34296 KB |
Output is correct |
16 |
Correct |
533 ms |
51448 KB |
Output is correct |
17 |
Correct |
327 ms |
50968 KB |
Output is correct |
18 |
Correct |
319 ms |
50936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
33272 KB |
Output is correct |
2 |
Correct |
37 ms |
33272 KB |
Output is correct |
3 |
Correct |
32 ms |
33168 KB |
Output is correct |
4 |
Correct |
41 ms |
33400 KB |
Output is correct |
5 |
Correct |
35 ms |
33400 KB |
Output is correct |
6 |
Correct |
35 ms |
33364 KB |
Output is correct |
7 |
Correct |
30 ms |
33144 KB |
Output is correct |
8 |
Correct |
197 ms |
46944 KB |
Output is correct |
9 |
Correct |
211 ms |
40440 KB |
Output is correct |
10 |
Correct |
527 ms |
51192 KB |
Output is correct |
11 |
Correct |
333 ms |
52344 KB |
Output is correct |
12 |
Correct |
316 ms |
50812 KB |
Output is correct |
13 |
Correct |
35 ms |
33144 KB |
Output is correct |
14 |
Correct |
206 ms |
46812 KB |
Output is correct |
15 |
Correct |
59 ms |
34296 KB |
Output is correct |
16 |
Correct |
534 ms |
51472 KB |
Output is correct |
17 |
Correct |
325 ms |
50808 KB |
Output is correct |
18 |
Correct |
318 ms |
50808 KB |
Output is correct |
19 |
Correct |
705 ms |
69656 KB |
Output is correct |
20 |
Correct |
700 ms |
66988 KB |
Output is correct |
21 |
Correct |
713 ms |
69496 KB |
Output is correct |
22 |
Correct |
700 ms |
67068 KB |
Output is correct |
23 |
Correct |
697 ms |
67064 KB |
Output is correct |
24 |
Correct |
699 ms |
67064 KB |
Output is correct |
25 |
Correct |
711 ms |
66936 KB |
Output is correct |
26 |
Correct |
709 ms |
69736 KB |
Output is correct |
27 |
Correct |
709 ms |
69620 KB |
Output is correct |
28 |
Correct |
703 ms |
67064 KB |
Output is correct |
29 |
Correct |
714 ms |
67100 KB |
Output is correct |
30 |
Correct |
704 ms |
67176 KB |
Output is correct |