Submission #480643

#TimeUsernameProblemLanguageResultExecution timeMemory
480643HaidaraWall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<wall.h> #define v(i) vector< i > using namespace std; const int maxn=200200; int n; struct node { int mx,mn,lazy,go; node():mx(0),mn(0),go(0){} }st[maxn*4]; void pull(int inx,int l,int r,int val=0) { if(val>0) { st[inx].mn=val; st[inx].mx=max(st[inx].mx,val); } else if(val<0) { st[inx].mx=val; st[inx].mn=min(val,st[inx].mn); } if(l!=r&&st[inx].go) { st[inx*2].go=1; st[inx*2+1].go=1; st[inx*2].mn=max(st[inx].mn,min(st[inx*2].mn,st[inx].mx)); st[inx*2].mx=min(st[inx].mx,max(st[inx*2].mx,st[inx].mn)); st[inx*2+1].mn=max(st[inx].mn,min(st[inx*2+1].mn,st[inx].mx)); st[inx*2+1].mx=min(st[inx].mx,max(st[inx*2+1].mx,st[inx].mn)); } st[inx].go=0; } void add(int ql,int qr,int val,int l=0,int r=n-1,int inx=1) { pull(inx,l,r); if(ql<=l&&r<=qr) { st[inx].go=1; pull(inx,l,r,val); return ; } if(ql>r||l>qr) return ; int mid=l+(r-l)/2; add(ql,qr,val,l,mid,inx*2); add(ql,qr,val,mid+1,r,inx*2+1); push_up(inx); } void del(int ql,int qr,int val,int l=0,int r=n-1,int inx=1) { pull(inx,l,r); if(ql<=l&&r<=qr) { st[inx].go=1; pull(inx,l,r,-val); return ; } if(ql>r||l>qr) return ; int mid=l+(r-l)/2; del(ql,qr,val,l,mid,inx*2); del(ql,qr,val,mid+1,r,inx*2+1); push_up(inx); } int query(int pos,int l=0,int r=n-1,int inx=1) { pull(inx,l,r); if(l==r) return st[inx].mn; int mid=l+(r-l)/2; int res; if(pos<=mid) res=query(pos,l,mid,inx*2); else res=query(pos,mid+1,r,inx*2+1); push_up(inx); return res; } void buildWall(int N, int k, int op[], int left[], int right[], int height[], int finalHeight[]) { n=N; for(int i=0;i<k;i++) { if(op[i]&1) add(left[i],right[i],height[i]); else del(left[i],right[i],height[i]); } for(int i=0;i<n;i++) finalHeight[i]=query(i); }

Compilation message (stderr)

wall.cpp: In function 'void add(int, int, int, int, int, int)':
wall.cpp:49:2: error: 'push_up' was not declared in this scope
   49 |  push_up(inx);
      |  ^~~~~~~
wall.cpp: In function 'void del(int, int, int, int, int, int)':
wall.cpp:65:2: error: 'push_up' was not declared in this scope
   65 |  push_up(inx);
      |  ^~~~~~~
wall.cpp: In function 'int query(int, int, int, int)':
wall.cpp:78:2: error: 'push_up' was not declared in this scope
   78 |  push_up(inx);
      |  ^~~~~~~