이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"wall.h"
#include<bits/stdc++.h>
using namespace std;
int flag[8000000][2];
void upd(int v,int mn,int mx){
flag[v][0]=min(max(flag[v][0],mn),mx);
flag[v][1]=min(max(flag[v][1],mn),mx);
}
void push(int v,int l,int r){
upd(v<<1,flag[v][0],flag[v][1]);
upd((v<<1)+1,flag[v][0],flag[v][1]);
flag[v][0]=0;
flag[v][1]=2e9;
}
void update(int v,int l,int r,int ql,int qr,int mn,int mx){
if(ql<=l&&r<=qr){
upd(v,mn,mx);
return;
}
if(r<ql||qr<l)return;
push(v,l,r);
int mid=(l+r)>>1;
update(v<<1,l,mid,ql,qr,mn,mx);
update((v<<1)+1,mid+1,r,ql,qr,mn,mx);
}
void build(int v,int l,int r,int* res){
if(l==r){
res[l]=flag[v][0];
return;
}
int mid=(l+r)>>1;
build(v<<1,l,mid,res);
build((v<<1)+1,mid+1,r,res);
}
void buildWall(int n,int k,int* type,int* l,int* r,int* h,int* res){
for(int i=0;i<k;i++)update(1,0,n-1,l[i],r[i],type[i]^2?h[i]:0,type[i]^1?h[i]:2e9);
build(1,0,n-1,res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |