Submission #968912

#TimeUsernameProblemLanguageResultExecution timeMemory
968912elotelo966Wall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "wall.h" using namespace std; 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: In function 'void push(int, int, int)':
wall.cpp:10:16: error: 'struct std::pair<int, int>' has no member named 'fi'
   10 |  if(lazy[node].fi==0 && lazy[node].se==0)return ;
      |                ^~
wall.cpp:10:36: error: 'struct std::pair<int, int>' has no member named 'se'
   10 |  if(lazy[node].fi==0 && lazy[node].se==0)return ;
      |                                    ^~
wall.cpp:12:21: error: 'mid' was not declared in this scope
   12 |   push(node*2,start,mid),push(node*2+1,mid+1,end);
      |                     ^~~
wall.cpp:17:17: error: 'struct std::pair<int, int>' has no member named 'fi'
   17 |   if(lazy[node].fi==1)fin[start]=max(fin[start],lazy[node].se);
      |                 ^~
wall.cpp:17:60: error: 'struct std::pair<int, int>' has no member named 'se'
   17 |   if(lazy[node].fi==1)fin[start]=max(fin[start],lazy[node].se);
      |                                                            ^~
wall.cpp:18:45: error: 'struct std::pair<int, int>' has no member named 'se'
   18 |   else fin[start]=min(fin[start],lazy[node].se);
      |                                             ^~
wall.cpp: In function 'void update(int, int, int, int, int, int, int)':
wall.cpp:31:22: error: 'mid' was not declared in this scope
   31 |  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:37:22: error: 'mid' was not declared in this scope
   37 |  finish(node*2,start,mid),finish(node*2+1,mid+1,end);
      |                      ^~~