이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wall.h"
#include<algorithm>
using namespace std;
int t[17000000];
void update(int l,int r,int L,int R,int v,int a,int b)
{
    if(l>r)
        return;
    if(l==L && r==R && t[v]!=-1)
    {
        if(t[v]<a && b==1)
            t[v]=a;
        if(t[v]>a && b==2)
            t[v]=a;
        return;
    }
    if(t[v]!=-1)
    {
        t[2*v]=t[v];
        t[2*v+1]=t[v];
        t[v]=-1;
    }
    int mid=(L+R)/2;
    update(l,min(mid,r),L,mid,2*v,a,b);
    update(max(l,mid+1),r,mid+1,R,2*v+1,a,b);
}
int get(int l,int r,int v,int a)
{
    if(l==r)
        return t[v];
    if(t[v]!=-1)
    {
        t[2*v]=t[v];
        t[2*v+1]=t[v];
        t[v]=-1;
    }
    int mid=(l+r)/2;
    if(a<=mid)
        get(l,mid,2*v,a);
    else
        get(mid+1,r,2*v+1,a);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
    for(int i=0;i<k;i++)
        update(left[i],right[i],0,n-1,1,height[i],op[i]);
    for(int i=0;i<n;i++)
        finalHeight[i]=get(0,n-1,1,i);
    return;
}
컴파일 시 표준 에러 (stderr) 메시지
wall.cpp: In function 'int get(int, int, int, int)':
wall.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
| # | 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... |