Submission #472697

#TimeUsernameProblemLanguageResultExecution timeMemory
472697HaidaraWall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include"wall.h" #include<algorithm> using namespace std; int maxn=2000000,inf=1e9+7; struct node { int mx=inf,mn=0; } st[maxn*4]; bool add=0; int ul,ur,val; void pull(int inx) { st[inx*2].mn=max(min(st[inx].mx,st[inx*2].mn),st[inx].mn); st[inx*2].mx=min(max(st[inx*2].mx,st[inx].mn),st[inx].mx); st[inx*2+1].mn=max(min(st[inx*2+1].mn,st[inx].mx),st[inx].mn); st[inx*2+1].mx=min(max(st[inx*2+1].mx,st[inx].mn),st[inx].mx); st[inx].mn=0; st[inx].mx=inf; } void update(int l,int r,int inx=1) { if(ul<=l&&r<=ur) { if(add) { st[inx].mn=max(st[inx].mn,val); st[inx].mx=max(st[inx].mn,st[inx].mx); } else { st[inx].mx=min(st[inx].mx,val); st[inx].mn=min(st[inx].mn,st[inx].mx); } if(l!=r) pull(inx); return ; } if(l>ur||ul>r) return ; pull(inx); int mid=l+(r-l)/2; update(l,mid,inx*2); update(mid+1,r,inx*2+1); } int query(int pos,int l,int r,int inx=1) { if(l==r) return st[inx].mn; int mid=l+(r-l)/2; pull(inx); if(pos<=mid) return query(pos,l,mid,inx*2); return query(pos,mid+1,r,inx*2+1); } void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]) { for(int i=0; i<k; i++) { val=height[i]; ul=left[i]+1; ur=right[i]+1; if(op[i]==1) add=1; else add=0; update(1,n); } for(int i=0; i<n; i++) finalHeight[i]=query(i+1,1,n); }

Compilation message (stderr)

wall.cpp:8:12: error: array bound is not an integer constant before ']' token
    8 | } st[maxn*4];
      |            ^
wall.cpp: In function 'void pull(int)':
wall.cpp:13:5: error: 'st' was not declared in this scope; did you mean 'std'?
   13 |     st[inx*2].mn=max(min(st[inx].mx,st[inx*2].mn),st[inx].mn);
      |     ^~
      |     std
wall.cpp: In function 'void update(int, int, int)':
wall.cpp:26:13: error: 'st' was not declared in this scope; did you mean 'std'?
   26 |             st[inx].mn=max(st[inx].mn,val);
      |             ^~
      |             std
wall.cpp:31:13: error: 'st' was not declared in this scope; did you mean 'std'?
   31 |             st[inx].mx=min(st[inx].mx,val);
      |             ^~
      |             std
wall.cpp: In function 'int query(int, int, int, int)':
wall.cpp:48:16: error: 'st' was not declared in this scope; did you mean 'std'?
   48 |         return st[inx].mn;
      |                ^~
      |                std