답안 #306655

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306655 2020-09-26T05:21:11 Z juggernaut 벽 (IOI14_wall) C++14
컴파일 오류
0 ms 0 KB
#include"wall.h"
#include<bits/stdc++.h>
using namespace std;
int treel[8000000],treer[8000000];
void update2(int v,int qd,int qu){
    treel[v]=min(qd,max(treel[v],qu));
    treer[v]=min(qd,max(treer[v],qu));
}
void push(int v,int l,int r){
    if(l!=r){
        update2(v<<1,treel[v],treer[v]);
        update2((v<<1)+1,treel[v],treer[v]);
    }
    treel[v]=0;
    treer[v]=2e9;
}
void update(int v,int l,int r,int ql,int qr,int qd,int qu){
    if(ql<=l&&r<=qr){
        update2(v,qd,qu);
        return;
    }
    int mid=(l+r)>>1;
    push(i,l,r);
    if(ql<=mid)update(v<<1,l,mid,ql,qr,qd,qu);
    if(mid<qr)update((v<<1)+1,mid+1,r,ql,qr,qd,qu);
}
void build(int v,int l,int r,int* res){
    if(l==r){
        res[l]=treel[v];
        return;
    }
    int mid=(l+r)>>1;
    push(v,l,r);
    build(v<<1,l,mid,res);
    build((v<<1)+1,mid+1,r,res);
}
void buildWall(int n,int k,int* type,int* l,int* r,int* h,int* res){
    for(int i=0;i<k;i++)update(1,0,n-1,l[i],r[i],type[i]&1?h[i]:0,op[i]&2?h[i]:2e9);
    build(1,0,n-1,res);
}

Compilation message

wall.cpp: In function 'void update(int, int, int, int, int, int, int)':
wall.cpp:23:10: error: 'i' was not declared in this scope
   23 |     push(i,l,r);
      |          ^
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:38:67: error: 'op' was not declared in this scope
   38 |     for(int i=0;i<k;i++)update(1,0,n-1,l[i],r[i],type[i]&1?h[i]:0,op[i]&2?h[i]:2e9);
      |                                                                   ^~