이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
struct node{
    int lowrbnd=0;
    int upprbnd=1e6;
};
vector<node>sgt(1<<22);
void push(int v){
    auto upd=[&](int &ind){
        ind=min(ind,sgt[v].upprbnd);
        ind=max(ind,sgt[v].lowrbnd); 
    };
        upd(sgt[2*v].upprbnd);
        upd(sgt[2*v].lowrbnd);
        upd(sgt[2*v+1].lowrbnd);
        upd(sgt[2*v+1].upprbnd);
        sgt[v]=node();
}
void build(int v,int tl, int tr){
    if(tl==tr){
        sgt[v].lowrbnd=0;
        sgt[v].upprbnd=0;
    }
    else{
        int tm=(tl+tr)/2;
        build(2*v,tl,tm);
        build(2*v+1,tm+1,tr);
    }
}
void upd_rng(int v, int tl, int tr, int l, int r, int typ, int val){
    if(l>r){
        return ;
    }
    if(tl==l&&tr==r){
        if(typ==1){
            //max with-> lowerbound update
            sgt[v].lowrbnd=max(val,sgt[v].lowrbnd);
            sgt[v].upprbnd=max(val,sgt[v].upprbnd);
        }
        else{
            //upper bound
            sgt[v].lowrbnd=min(val,sgt[v].lowrbnd);
            sgt[v].upprbnd=min(val,sgt[v].upprbnd);
        }
    }
    else{
        push(v);
        int tm=(tl+tr)/2;
        upd_rng(2*v,tl,tm,l,min(r,tm),typ,val);
        upd_rng(2*v+1,tm+1,tr,max(tm+1,l),r,typ,val);
    }
}
void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]){
    int N=(1<<21)-1;
    build(1,0,N);
    for(int i=0;i<k;i++){
        upd_rng(1,0,N,left[i],right[i],op[i],height[i]);
    }
    for(int v=1;v<(1<<21);v++){
        push(v);
    }
    for(int i=0;i<n;i++){
        finalHeight[i]=sgt[i+(1<<21)].lowrbnd;
    }
}
| # | 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... |