Submission #239209

# Submission time Handle Problem Language Result Execution time Memory
239209 2020-06-14T19:57:00 Z aggu_01000101 Wall (IOI14_wall) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
#define INF 1000000000000000
#define lchild(i) (i*2 + 1)
#define rchild(i) (i*2 + 2)
#define mid(l, u) ((l+u)/2)
#define x(p) p.first
#define y(p) p.second
#define MOD 998244353
using namespace std;
const int N = 2000005;
int seg[4*N];
pair<int, int> lazy[4*N];
int build(int l, int u, int i){
    lazy[i] = {-INF, INF};
    if(l==u) return seg[i] = 0;
    return seg[i] = min(build(l, mid(l, u), lchild(i)), build(mid(l, u)+1, u, rchild(i)));
}
int query(int l, int u, int i, int ll, int uu){
    if(lazy[i].second != INF || lazy[i].first != INF){
        seg[i] = min(seg[i], lazy[i].second);
        seg[i] = max(seg[i], lazy[i].first);
        if(l!=u){
            lazy[lchild(i)].second = min(lazy[lchild(i)].second, lazy[i].second);
            lazy[lchild(i)].first = min(lazy[lchild(i)].first, lazy[i].second);
            lazy[lchild(i)].first = max(lazy[lchild(i)].first, lazy[i].first);
            lazy[lchild(i)].second = max(lazy[lchild(i)].second, lazy[i].first);

            lazy[rchild(i)].second = min(lazy[rchild(i)].second, lazy[i].second);
            lazy[rchild(i)].first = min(lazy[rchild(i)].first, lazy[i].second);
            lazy[rchild(i)].first = max(lazy[rchild(i)].first, lazy[i].first);
            lazy[rchild(i)].second = max(lazy[rchild(i)].second, lazy[i].first);
        }
        lazy[i].second = INF;
        lazy[i].first = -INF;
    }
    if(l>=ll && u<=uu) return seg[i];
    if(l>uu || u<ll) return INF;
    return min(query(l, mid(l, u), lchild(i), ll, uu), query(mid(l, u)+1, u, rchild(i), ll, uu));
}
int update(int l, int u, int i, int ll, int uu, int upval, int type){
    if(lazy[i].second != INF || lazy[i].first != INF){
        seg[i] = min(seg[i], lazy[i].second);
        seg[i] = max(seg[i], lazy[i].first);
        if(l!=u){
            lazy[lchild(i)].second = min(lazy[lchild(i)].second, lazy[i].second);
            lazy[lchild(i)].first = min(lazy[lchild(i)].first, lazy[i].second);
            lazy[lchild(i)].first = max(lazy[lchild(i)].first, lazy[i].first);
            lazy[lchild(i)].second = max(lazy[lchild(i)].second, lazy[i].first);

            lazy[rchild(i)].second = min(lazy[rchild(i)].second, lazy[i].second);
            lazy[rchild(i)].first = min(lazy[rchild(i)].first, lazy[i].second);
            lazy[rchild(i)].first = max(lazy[rchild(i)].first, lazy[i].first);
            lazy[rchild(i)].second = max(lazy[rchild(i)].second, lazy[i].first);
        }
        lazy[i].second = INF;
        lazy[i].first = -INF;
    }
    if(l>=ll && u<=uu){
        if(type==1){
            lazy[i].first = max(lazy[i].first, upval);
        }
        else{
            lazy[i].second = min(lazy[i].second, upval);
        }
        if(lazy[i].second != INF || lazy[i].first != INF){
            seg[i] = min(seg[i], lazy[i].second);
            seg[i] = max(seg[i], lazy[i].first);
            if(l!=u){
                lazy[lchild(i)].second = min(lazy[lchild(i)].second, lazy[i].second);
                lazy[lchild(i)].first = min(lazy[lchild(i)].first, lazy[i].second);
                lazy[lchild(i)].first = max(lazy[lchild(i)].first, lazy[i].first);
                lazy[lchild(i)].second = max(lazy[lchild(i)].second, lazy[i].first);

                lazy[rchild(i)].second = min(lazy[rchild(i)].second, lazy[i].second);
                lazy[rchild(i)].first = min(lazy[rchild(i)].first, lazy[i].second);
                lazy[rchild(i)].first = max(lazy[rchild(i)].first, lazy[i].first);
                lazy[rchild(i)].second = max(lazy[rchild(i)].second, lazy[i].first);
            }
            lazy[i].second = INF;
            lazy[i].first = -INF;
        }
        return seg[i];
    }
    if(l>uu || u<ll) return seg[i];
    return seg[i] = min(update(l, mid(l, u), lchild(i), ll, uu, upval, type), update(mid(l, u)+1, u, rchild(i), ll, uu, upval, type));
}
void buildwall(int n, int k, int op[], int left[], int right[], int height[], int finalheight[]){
    build(0, n-1, 0);
    for(int i = 0;i<k;i++){
        update(0, n-1, 0, left[i], right[i], op[i], height[i]);
    }
    for(int i = 0;i<n;i++) finalheight[i] = query(0, n-1, 0, i, i);
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

}

Compilation message

/tmp/ccnPnErF.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc2nw0r3.o:wall.cpp:(.text.startup+0x0): first defined here
/tmp/ccnPnErF.o: In function `main':
grader.cpp:(.text.startup+0x113): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status