제출 #480140

#제출 시각아이디문제언어결과실행 시간메모리
480140Apiram벽 (IOI14_wall)C++14
컴파일 에러
0 ms0 KiB
#include "wall.h" #include<bits/stdc++.h> using namespace std; const int64_t MXN = 1e6; vector<int64_t>tree(4*MXN); vector<int64_t>lazy(4*MXN); int64_t func(int64_t a,int64_t b){ return min(a,b); } void build(int64_t node,int64_t node_low,int64_t node_high){ if (node_low==node_high){ tree[node]=0 } else { int64_t mid =(node_low+node_high)>>1; build(arr,node*2,node_low,mid); build(arr,node*2 + 1,mid+1,node_high); tree[node]=func(tree[node*2],tree[node*2 + 1]); } } void push(int64_t x){ tree[x + x] = min(tree[x],tree[x+x]); tree[x + x + 1] = min(tree[x],tree[x+x + 1]); } void update(int64_t node,int64_t node_low,int64_t node_high,int64_t q_low,int64_t q_high,int64_t new_val,int ok){ if (node_low>node_high||node_low>q_high||node_high<q_low)return; if (q_low<=node_low&&q_high>=node_high){ if (ok==1){ tree[node] = max(tree[node],new_val); } else{ tree[node] = min(tree[node],new_val); } return ; } push(node); int64_t mid = (node_low + node_high)/2; update(node*2,node_low,mid,q_low,q_high,new_val); update(node*2 + 1,mid + 1,node_high,q_low,q_high,new_val); tree[node]= func(tree[node*2],tree[node*2 + 1]); } int64_t query(int64_t node,int64_t node_low,int64_t node_high,int64_t query_low,int64_t query_high){ if (node_low>node_high||node_low>query_high||node_high<query_low)return 0; if (query_low<=node_low&&query_high>=node_high){ return tree[node]; } int64_t mid = (node_low+node_high)/2; return func(query(node*2,node_low,mid,query_low,query_high),query(node*2 + 1,mid+1,node_high,query_low,query_high)); } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ build(1,0,n-1); for (int i =0;i<k;++i){ update(1,0,n-1,left[i],right[i],height[i],op[i]); } for (int i = 0;i<n;++i){ finalHeight[i] = query(1,0,n-1,i,i); } }

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

wall.cpp: In function 'void build(int64_t, int64_t, int64_t)':
wall.cpp:12:15: error: expected ';' before '}' token
   12 |   tree[node]=0
      |               ^
      |               ;
   13 |  }
      |  ~             
wall.cpp:16:9: error: 'arr' was not declared in this scope
   16 |   build(arr,node*2,node_low,mid);
      |         ^~~
wall.cpp: In function 'void update(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int)':
wall.cpp:41:49: error: too few arguments to function 'void update(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int)'
   41 |  update(node*2,node_low,mid,q_low,q_high,new_val);
      |                                                 ^
wall.cpp:27:6: note: declared here
   27 | void update(int64_t node,int64_t node_low,int64_t node_high,int64_t q_low,int64_t q_high,int64_t new_val,int ok){
      |      ^~~~~~
wall.cpp:42:59: error: too few arguments to function 'void update(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int)'
   42 |  update(node*2  + 1,mid + 1,node_high,q_low,q_high,new_val);
      |                                                           ^
wall.cpp:27:6: note: declared here
   27 | void update(int64_t node,int64_t node_low,int64_t node_high,int64_t q_low,int64_t q_high,int64_t new_val,int ok){
      |      ^~~~~~