# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
337795 |
2020-12-21T16:24:44 Z |
bigDuck |
Wall (IOI14_wall) |
C++14 |
|
1598 ms |
67052 KB |
#include "wall.h"
#include<bits/stdc++.h>
using namespace std;
#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
pii seg[8000010];
pii nil={-1, -1};
void build(int v, int tl, int tr){
if(tl==tr){
seg[v]=nil;
return;
}
int mid=(tl+tr)>>1ll;
build(v*2, tl, mid); build(2*v+1, mid+1, tr);
}
void lazy(pii &sus, pii &jos){
if(sus==nil){return;}
if(jos==nil){jos={sus.ft, sus.sc}; sus=nil; return;}
int hs=sus.ft, rs=sus.sc, hj=jos.ft, rj=jos.sc;
if(rs<hj){
jos={max(rs, hs), min(rs, rj)};
}
else{
jos={max(hj, hs), min(rs, rj)};
}
sus=nil;
return;
}
void update(int v, int tl, int tr, int l, int r, int tp, int x){
if(l>r){return;}
if( (tl==l) && (tr==r) ){
pii p={0, 0};
if(tp==1){
p.ft=x; p.sc=100000;
}
else{
p.sc=x;
}
lazy(p, seg[v]);
return;
}
pii p={seg[v].ft, seg[v].sc};
lazy(seg[v], seg[v*2]), lazy(p, seg[v*2+1]);
int mid=(tl+tr)>>1ll;
update(2*v, tl, mid, l, min(r, mid), tp, x); update(2*v+1, mid+1,tr, max(l, mid+1),r, tp, x);
return;
}
int query(int v, int tl, int tr, int p){
int mid=(tl+tr)>>1ll;
if(tl==tr){
return seg[v].ft;
}
pii pr={seg[v].ft, seg[v].sc};
lazy(seg[v], seg[v*2]), lazy(pr, seg[v*2+1]);
if(p<=mid){
return query(2*v, tl, mid, p);
}
else{
return query(2*v+1, mid+1, tr, p);
}
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
build(1, 1, n);
for(int i=0; i<k; i++){
update(1, 1, n, left[i]+1, right[i]+1, op[i], height[i]);
}
for(int i=0; i<n; i++){
finalHeight[i]=query(1, 1, n,i+1);
}
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Correct |
2 ms |
364 KB |
Output is correct |
4 |
Correct |
9 ms |
876 KB |
Output is correct |
5 |
Correct |
8 ms |
876 KB |
Output is correct |
6 |
Correct |
8 ms |
876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
165 ms |
14144 KB |
Output is correct |
3 |
Correct |
238 ms |
8028 KB |
Output is correct |
4 |
Correct |
703 ms |
18492 KB |
Output is correct |
5 |
Correct |
408 ms |
19052 KB |
Output is correct |
6 |
Correct |
401 ms |
19068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
492 KB |
Output is correct |
3 |
Correct |
3 ms |
364 KB |
Output is correct |
4 |
Correct |
9 ms |
876 KB |
Output is correct |
5 |
Correct |
8 ms |
876 KB |
Output is correct |
6 |
Correct |
8 ms |
876 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
165 ms |
13932 KB |
Output is correct |
9 |
Correct |
241 ms |
7988 KB |
Output is correct |
10 |
Correct |
718 ms |
18540 KB |
Output is correct |
11 |
Correct |
412 ms |
19052 KB |
Output is correct |
12 |
Correct |
402 ms |
19052 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
169 ms |
14116 KB |
Output is correct |
15 |
Correct |
51 ms |
2028 KB |
Output is correct |
16 |
Correct |
753 ms |
18796 KB |
Output is correct |
17 |
Correct |
404 ms |
18796 KB |
Output is correct |
18 |
Correct |
413 ms |
18796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Correct |
2 ms |
364 KB |
Output is correct |
4 |
Correct |
10 ms |
876 KB |
Output is correct |
5 |
Correct |
8 ms |
876 KB |
Output is correct |
6 |
Correct |
8 ms |
876 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
164 ms |
13932 KB |
Output is correct |
9 |
Correct |
237 ms |
8044 KB |
Output is correct |
10 |
Correct |
724 ms |
18540 KB |
Output is correct |
11 |
Correct |
405 ms |
19180 KB |
Output is correct |
12 |
Correct |
394 ms |
18976 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
167 ms |
13932 KB |
Output is correct |
15 |
Correct |
43 ms |
2028 KB |
Output is correct |
16 |
Correct |
759 ms |
18796 KB |
Output is correct |
17 |
Correct |
398 ms |
18796 KB |
Output is correct |
18 |
Correct |
405 ms |
18780 KB |
Output is correct |
19 |
Correct |
1554 ms |
66796 KB |
Output is correct |
20 |
Correct |
1552 ms |
64236 KB |
Output is correct |
21 |
Correct |
1550 ms |
66904 KB |
Output is correct |
22 |
Correct |
1543 ms |
64236 KB |
Output is correct |
23 |
Correct |
1557 ms |
64428 KB |
Output is correct |
24 |
Correct |
1546 ms |
64404 KB |
Output is correct |
25 |
Correct |
1548 ms |
64564 KB |
Output is correct |
26 |
Correct |
1598 ms |
66892 KB |
Output is correct |
27 |
Correct |
1559 ms |
67052 KB |
Output is correct |
28 |
Correct |
1539 ms |
64428 KB |
Output is correct |
29 |
Correct |
1556 ms |
61104 KB |
Output is correct |
30 |
Correct |
1545 ms |
61164 KB |
Output is correct |