제출 #358483

#제출 시각아이디문제언어결과실행 시간메모리
358483medmdg벽 (IOI14_wall)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll N=2000009; int ma[4*N]; int a[4*N]; int mi[4*N]; void build(int l,int r,int p){ ma[p]=200000; mi[p]=0; a[p]=0; if(l==r){ return; } build(l,(l+r)/2,p*2); build((l+r)/2+1,r,p*2+1); return; } void setla(int l,int r,int p){ if(l==r) return; if((l+r)/2-l!=0){ ma[p*2]=max(ma[p*2],mi[p]); mi[p*2]=min(mi[p*2],ma[p]); ma[p*2]=min(ma[p],ma[p*2]); mi[p*2]=max(mi[p*2],mi[p]); }else{ if(a[p*2]>ma[p]) a[p*2]=ma[p]; if(a[p*2]<mi[p]) a[p*2]=mi[p]; } if((l+r)/2+1!=r){ ma[p*2+1]=max(ma[p*2+1],mi[p]); mi[p*2+1]=min(mi[p*2+1],ma[p]); ma[p*2+1]=min(ma[p],ma[p*2+1]); mi[p*2+1]=max(mi[p*2+1],mi[p]); }else{ if(a[p*2+1]>ma[p]) a[p*2+1]=ma[p]; if(a[p*2+1]<mi[p]) a[p*2+1]=mi[p]; } ma[p]=200000; mi[p]=0; return; } void upre(int x,int y,int h,int l,int r,int p){ setla(l,r,p); if(x==l&&l==r){ if(a[p]>h) a[p]=h; return; } if(y<l||x>r) return; if(r<=y&&l>=r){ ma[p]=h; setla(l,r,p); return; } upre(x,y,h,l,(l+r)/2,p*2); upre(x,y,h,(l+r)/2+1,r,p*2+1); return; } void upad(int x,int y,int h,int l,int r,int p){ setla(l,r,p); if(x==l&&l==r){ if(a[p]<h) a[p]=h; return; } if(y<l||x>r) return; if(r<=y&&l>=r){ mi[p]=h; setla(l,r,p); return; } upad(x,y,h,l,(l+r)/2,p*2); upad(x,y,h,(l+r)/2+1,r,p*2+1); return; } vector<int> ans; void over(int l,int r,int p){ setla(l,r,p); if(l==r){ ans.push_back(a[p]); return; } over(l,(l+r)/2,p*2); over((l+r)/2+1,r,p*2+1); return; } void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]){ build(1,n,1); for(int i=0;i<k;i++){ left[i]++; right[i]++; } for(int i=0;i<k;i++){ if(op[i]-1){ upre(left[i],right[i],height[i],1,n,1); }else{ upad(left[i],right[i],height[i],1,n,1); } } over(1,n,1); for(int i=0;i<n;i++) finalHeight[i]=ans[i]; return; }

컴파일 시 표준 에러 (stderr) 메시지

wall.cpp:5:11: error: array bound is not an integer constant before ']' token
    5 | int ma[4*N];
      |           ^
wall.cpp:6:10: error: array bound is not an integer constant before ']' token
    6 | int a[4*N];
      |          ^
wall.cpp:7:11: error: array bound is not an integer constant before ']' token
    7 | int mi[4*N];
      |           ^
wall.cpp: In function 'void build(int, int, int)':
wall.cpp:9:5: error: 'ma' was not declared in this scope; did you mean 'fma'?
    9 |     ma[p]=200000;
      |     ^~
      |     fma
wall.cpp:10:5: error: 'mi' was not declared in this scope
   10 |     mi[p]=0;
      |     ^~
wall.cpp:11:5: error: 'a' was not declared in this scope
   11 |     a[p]=0;
      |     ^
wall.cpp: In function 'void setla(int, int, int)':
wall.cpp:23:9: error: 'ma' was not declared in this scope; did you mean 'fma'?
   23 |         ma[p*2]=max(ma[p*2],mi[p]);
      |         ^~
      |         fma
wall.cpp:23:29: error: 'mi' was not declared in this scope
   23 |         ma[p*2]=max(ma[p*2],mi[p]);
      |                             ^~
wall.cpp:28:12: error: 'a' was not declared in this scope
   28 |         if(a[p*2]>ma[p])
      |            ^
wall.cpp:28:19: error: 'ma' was not declared in this scope; did you mean 'fma'?
   28 |         if(a[p*2]>ma[p])
      |                   ^~
      |                   fma
wall.cpp:30:12: error: 'a' was not declared in this scope
   30 |         if(a[p*2]<mi[p])
      |            ^
wall.cpp:30:19: error: 'mi' was not declared in this scope
   30 |         if(a[p*2]<mi[p])
      |                   ^~
wall.cpp:34:9: error: 'ma' was not declared in this scope; did you mean 'fma'?
   34 |         ma[p*2+1]=max(ma[p*2+1],mi[p]);
      |         ^~
      |         fma
wall.cpp:34:33: error: 'mi' was not declared in this scope
   34 |         ma[p*2+1]=max(ma[p*2+1],mi[p]);
      |                                 ^~
wall.cpp:39:12: error: 'a' was not declared in this scope
   39 |         if(a[p*2+1]>ma[p])
      |            ^
wall.cpp:39:21: error: 'ma' was not declared in this scope; did you mean 'fma'?
   39 |         if(a[p*2+1]>ma[p])
      |                     ^~
      |                     fma
wall.cpp:41:12: error: 'a' was not declared in this scope
   41 |         if(a[p*2+1]<mi[p])
      |            ^
wall.cpp:41:21: error: 'mi' was not declared in this scope
   41 |         if(a[p*2+1]<mi[p])
      |                     ^~
wall.cpp:44:5: error: 'ma' was not declared in this scope; did you mean 'fma'?
   44 |     ma[p]=200000;
      |     ^~
      |     fma
wall.cpp:45:5: error: 'mi' was not declared in this scope
   45 |     mi[p]=0;
      |     ^~
wall.cpp: In function 'void upre(int, int, int, int, int, int)':
wall.cpp:51:12: error: 'a' was not declared in this scope
   51 |         if(a[p]>h)
      |            ^
wall.cpp:58:9: error: 'ma' was not declared in this scope; did you mean 'fma'?
   58 |         ma[p]=h;
      |         ^~
      |         fma
wall.cpp: In function 'void upad(int, int, int, int, int, int)':
wall.cpp:69:12: error: 'a' was not declared in this scope
   69 |         if(a[p]<h)
      |            ^
wall.cpp:76:9: error: 'mi' was not declared in this scope
   76 |         mi[p]=h;
      |         ^~
wall.cpp: In function 'void over(int, int, int)':
wall.cpp:88:23: error: 'a' was not declared in this scope
   88 |         ans.push_back(a[p]);
      |                       ^