제출 #596110

#제출 시각아이디문제언어결과실행 시간메모리
596110neki벽 (IOI14_wall)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define vc vector

using namespace std;

const int mn=2000000;
int tl[4 * mn], tr[4 * mn];

void apply(int no, int m, int M){
    if(tr[no]<=m) tl[no]=tr[no]=m;
    else if(M<=tl[no]) tl[no]=tr[no]=M;
    else tl[no]=max(tl[no], m), tr[no]=min(tr[no], M);
}
void push(int no){
    apply(no * 2 +1, tl[no], tr[no]);
    apply(no * 2 +2, tl[no], tr[no]);
    tl[no]=0, tr[no]=INT_MAX;
}
void update(int ql, int qr, int m, int M, int l, int r, int no){
    if(ql==l and qr==r) apply(no, m, M);
    else{
        int mid=(l+r)/2;
        push(no);
        if(qr<=mid) update(ql, qr, m, M, l, mid, no * 2 +1);
        else if(mid<ql) update(ql, qr, m, M, mid+1, r, no * 2 +2);
        else update(ql, mid, m, M, l, mid, no * 2 + 1), update(mid+1, qr, m, M, mid+1, r, no * 2 +2);
    }
}
void build(int l, int r, int no, vc<int>& ans){
    if(l==r) ans[l]=tl[no];
    else{
        int mid=(l+r)/2;
        push(no);
        build(l, mid, no * 2 +1, ans);
        build(mid+1, r, no * 2 + 2, ans);
    }
}

void buildWall(int n, int k, vc<int> op, vc<int> ql, vc<int> qr, vc<int> h, vc<int>& ans){
    for(int i=0;i<k;++i){
        if(op[i]==1) update(ql[i], qr[i], h[i], INT_MAX, 0, n-1, 0);
        if(op[i]==2) update(ql[i], qr[i], 0, h[i], 0, n-1, 0);
    }
    build(0, n-1, 0, ans);
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccWjBICW.o: in function `main':
grader.cpp:(.text.startup+0x133): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status