Submission #968911

#TimeUsernameProblemLanguageResultExecution timeMemory
968911elotelo966Wall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include "wall.h" pair<int,int> lazy[8000000]; int fin[2000000]; inline void push(int node,int start,int end){ if(lazy[node].fi==0 && lazy[node].se==0)return ; if(start!=end){ push(node*2,start,mid),push(node*2+1,mid+1,end); lazy[node*2]=lazy[node]; lazy[node*2+1]=lazy[node]; } else{ if(lazy[node].fi==1)fin[start]=max(fin[start],lazy[node].se); else fin[start]=min(fin[start],lazy[node].se); } lazy[node]=make_pair(0,0); } inline void update(int node,int start,int end,int l,int r,int val,int sem){ if(start>end || start>r || end<l)return ; push(node,start,end); if(start>=l && end<=r){ lazy[node]=make_pair(sem,val); push(node,start,end); return ; } update(node*2,start,mid,l,r,val,sem),update(node*2+1,mid+1,end,l,r,val,sem); } inline void finish(int node,int start,int end){ push(node,start,end); if(start==end)return ; finish(node*2,start,mid),finish(node*2+1,mid+1,end); } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ for(int i=0;i<k;i++){ if(op[i]==1){ update(1,0,n-1,left[i],right[i],height[i],1); } else{ update(1,0,n-1,left[i],right[i],height[i],-1); } } finish(1,0,n-1); for(int i=0;i<n;i++){ finalHeight[i]=fin[i]; } return; }

Compilation message (stderr)

wall.cpp:3:1: error: 'pair' does not name a type
    3 | pair<int,int> lazy[8000000];
      | ^~~~
wall.cpp: In function 'void push(int, int, int)':
wall.cpp:7:5: error: 'lazy' was not declared in this scope
    7 |  if(lazy[node].fi==0 && lazy[node].se==0)return ;
      |     ^~~~
wall.cpp:9:21: error: 'mid' was not declared in this scope
    9 |   push(node*2,start,mid),push(node*2+1,mid+1,end);
      |                     ^~~
wall.cpp:10:3: error: 'lazy' was not declared in this scope
   10 |   lazy[node*2]=lazy[node];
      |   ^~~~
wall.cpp:14:6: error: 'lazy' was not declared in this scope
   14 |   if(lazy[node].fi==1)fin[start]=max(fin[start],lazy[node].se);
      |      ^~~~
wall.cpp:14:34: error: 'max' was not declared in this scope
   14 |   if(lazy[node].fi==1)fin[start]=max(fin[start],lazy[node].se);
      |                                  ^~~
wall.cpp:15:19: error: 'min' was not declared in this scope; did you mean 'fin'?
   15 |   else fin[start]=min(fin[start],lazy[node].se);
      |                   ^~~
      |                   fin
wall.cpp:17:2: error: 'lazy' was not declared in this scope
   17 |  lazy[node]=make_pair(0,0);
      |  ^~~~
wall.cpp:17:13: error: 'make_pair' was not declared in this scope
   17 |  lazy[node]=make_pair(0,0);
      |             ^~~~~~~~~
wall.cpp: In function 'void update(int, int, int, int, int, int, int)':
wall.cpp:24:3: error: 'lazy' was not declared in this scope
   24 |   lazy[node]=make_pair(sem,val);
      |   ^~~~
wall.cpp:24:14: error: 'make_pair' was not declared in this scope
   24 |   lazy[node]=make_pair(sem,val);
      |              ^~~~~~~~~
wall.cpp:28:22: error: 'mid' was not declared in this scope
   28 |  update(node*2,start,mid,l,r,val,sem),update(node*2+1,mid+1,end,l,r,val,sem);
      |                      ^~~
wall.cpp: In function 'void finish(int, int, int)':
wall.cpp:34:22: error: 'mid' was not declared in this scope
   34 |  finish(node*2,start,mid),finish(node*2+1,mid+1,end);
      |                      ^~~