Submission #205234

# Submission time Handle Problem Language Result Execution time Memory
205234 2020-02-28T11:01:46 Z awlintqaa Wall (IOI14_wall) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define sqr 200
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef short int si;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1e9+7;
const ll inf= 2e9;
const ld pai=acos(-1);
#include "wall.h"
struct NODE{
        int tree,on,mn,mx;
        NODE *left,*right;
        NODE(){
                tree=on=0;
                mn=-inf,mx=inf;
                left=right=NULL;
        }
}*root=new NODE;
void fill(NODE *pre,NODE *node){
        if(node->on==0){
                node->on=pre->on;
                node->mn=pre->mn;
                node->mx=pre->mx;
                return ;
        }
        node->mn=max(node->mn,pre->mn);
        node->mx=max(node->mx,pre->mx);
        node->mx=min(node->mx,pre->mx);
        node->mn=min(node->mn,pre->mx);
}
void lzyUPD(NODE *node,int l,int r){
        if(node->on==0)return ;
        node->tree=max(node->tree,node->mn);
        node->tree=min(node->tree,node->mx);
  		if(l!=r){
        	if(node->left==NULL)node->left=new NODE;
        	if(node->right==NULL)node->right=new NODE;
        	fill(node,node->left);
        	fill(node,node->right);
        }
        node->on=0;
        node->mn=-inf;
        node->mx=inf;
}
void upd(NODE *node,int l,int r,int s,int e,int x,int t){;
        lzyUPD(node,l,r);
        if(s<=l && e>=r){
                if(t==1)node->mn=x,node->mx=inf;
                if(t==2)node->mn=-inf,node->mx=x;
                node->on=1;
                lzyUPD(node,l,r);
                return ;
        }
        if(s<=mid){
                if(node->left==NULL)node->left=new NODE;
                upd(node->left,l,mid,s,e,x,t);
        }
        if(e>=mid+1){
                if(node->right==NULL)node->right=new NODE;
                upd(node->right,mid+1,r,s,e,x,t);
        }
        if(node->left==NULL)node->left=new NODE;
        if(node->right==NULL)node->right=new NODE;
        lzyUPD(node->left,l,mid),lzyUPD(node->right,mid+1,r);
        int ret=0;
        if(node->left!=NULL)ret=max(ret,node->left->tree);
        if(node->right!=NULL)ret=max(ret,node->right->tree);
        node->tree=ret;
}
int query(NODE *node,int l,int r,int id){
        lzyUPD(node);
        if(l==r)return node->tree;
        if(id<=mid){
                if(node->left==NULL)return 0;
                return query(node->left,l,mid,id);
        }
        if(node->right==NULL)return 0;
        return query(node->right,mid+1,r,id);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
        for(int i=0;i<k;i++)upd(root,0,n-1,left[i],right[i],height[i],op[i]);
        for(int i=0;i<n;i++)finalHeight[i]=query(root,0,n-1,i);
}

Compilation message

wall.cpp: In function 'int query(NODE*, int, int, int)':
wall.cpp:90:20: error: too few arguments to function 'void lzyUPD(NODE*, int, int)'
         lzyUPD(node);
                    ^
wall.cpp:50:6: note: declared here
 void lzyUPD(NODE *node,int l,int r){
      ^~~~~~