Submission #208315

# Submission time Handle Problem Language Result Execution time Memory
208315 2020-03-10T16:59:47 Z Lukoloz Wall (IOI14_wall) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "wall.h"
#define ll long long
#define MAXN 2000005
#define ff first
#define ss second
#define INF 999999999
using namespace std;
int l[3*MAXN],r[3*MAXN],xl,xr,xi;
pair <int,int> st[3*MAXN],cp;
void buil(int i){
    st[i]={0,INF};
    if (l[i]==r[i]) return;
    l[i*2]=l[i] r[i*2]=(l[i]+r[i])/2;
    l[i*2+1]=r[i*2]+1; r[i*2+1]=r[i];
    buil(i*2); buil(i*2+1);
}
pair<int,int> cramb(pair<int,int> p1, pair<int,int> p2){
    pair<int,int> tp;
    tp={max(p1.ff,p2.ff),min(p1.ss,p2.ss)};
    if (tp.ff<=tp.ss) return tp;
    if (p2.ff>p1.ss) return {p2.ff,p2.ff};
    else return {p2.ss,p2.ss};
}
void add(int i){
    if (l[i]>xr || r[i]<xl) return;
    if (l[i]>=xl && r[i]<=xr){
        st[i]=cramb(st[i],cp);
        return;
    }
    st[i*2]=cramb(st[i*2],st[i]);
    st[i*2+1]=cramb(st[i*2+1],st[i]);
    st[i]={0,INF};
    add(i*2); add(i*2+1);
}
int ret(int i){
    if (l[i]==r[i]){
        return cramb({0,0},st[i]).ff;
    }
    int tret;
    if (xi<=r[i*2]) tret=ret(i*2);
    else tret=ret(i*2+1);
    return cramb({tret,tret},st[i]).ff;
}
void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]){
    l[1]=0,r[1]=n-1;
    buil(1);
    for (int i=0; i<k; i++){
        xl=left[i],xr=right[i];
        if (op[i]==1) cp={height[i],INF};
        else cp={0,height[i]};
        add(1);
    }
    for (int i=0; i<n; i++){
        xi=i;
        finalHeight[i]=ret(1);
    }
}

Compilation message

wall.cpp: In function 'void buil(int)':
wall.cpp:14:17: error: expected ';' before 'r'
     l[i*2]=l[i] r[i*2]=(l[i]+r[i])/2;
                 ^