Submission #235982

# Submission time Handle Problem Language Result Execution time Memory
235982 2020-05-30T14:53:06 Z Bilyana Wall (IOI14_wall) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
#define f first
#define s second

using namespace std;

const int MAXA = 1e6;
vector<pair<int, int>> st;
vector<pair<int, int>> lp;

void updateLazy(int curr, bool leaf, int pos) {
    if (leaf) {
        st[pos].f = max(st[pos].f, min(lp[curr].f, st[pos].s));
        st[pos].s = min(lp[pos].s, max(lp[curr].s, lp[pos].f));
        return;
    }
    lp[curr*2].f = max(lp[curr*2].f, min(lp[curr].f, lp[curr*2].s));
    lp[curr*2].s = min(lp[curr*2].s, max(lp[curr].s, lp[curr*2].f));
    lp[curr*2+1].f = max(lp[curr*2+1].f, min(lp[curr].f, lp[curr*2+1].s));
    lp[curr*2+1].s = min(lp[curr*2+1].s, max(lp[curr].s, lp[curr*2+1].f));
    lp[curr] = {0, MAXA};

}

void update(int curr, int l, int r, int b, int e, int val, int type) {
    updateLazy(curr, l==r, l);
    if (l > e || r < b) {
        return;
    }

    if (l >= b && r <= e) {
        if (type == 1) {
            lp[curr].f = val;
        } else if (type == 2) {
            lp[curr].s = val;
        }
        return;
    }
    int mid = (l+r)/2;
    update(curr*2, l, mid, b, e, val, type);
    update(curr*2+1, mid+1, r, b, e, val, type);
}

void calcAns(int curr, int l, int r) {
    cerr<<l<<' '<<r<<" - "<<lp[curr].f<<' '<<lp[curr].s<<endl;
    updateLazy(curr, l==r, l);
    if (l == r) {
        return;
    }

    int mid = (l+r)/2;
    calcAns(curr*2, l, mid);
    calcAns(curr*2+1, mid+1, r);
}

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
    st.resize(n, {0, MAXA}), lp.resize(4*n, {0, MAXA});
    for (int i=k-1; i>=0; i--) {
        update(1, 0, n-1, left[i], right[i], height[i], op[i]);
    }
    calcAns(1, 0, n-1);
    for (int i=0; i<n; i++) {
        finalHeight[i] = st[i].f;
    }
    return;
}

Compilation message

wall.cpp:2:10: fatal error: grader.h: No such file or directory
 #include "grader.h"
          ^~~~~~~~~~
compilation terminated.