제출 #70143

#제출 시각아이디문제언어결과실행 시간메모리
70143yusufake벽 (IOI14_wall)C++98
100 / 100
1095 ms181500 KiB
#include<bits/stdc++.h> using namespace std; #include "wall.h" #define N 2000006 #define tm (tl+tr >> 1) int A[N<<2],B[N<<2],T[N]; void put1(int v, int x){ A[v] = max(A[v],x); B[v] = max(B[v] , A[v]); } void put2(int v, int x){ B[v] = min(B[v],x); A[v] = min(A[v] , B[v]); } void push(int v){ put1(v+v,A[v]); put1(v+v+1,A[v]); A[v] = 0; put2(v+v,B[v]); put2(v+v+1,B[v]); B[v] = N; } void f(int v, int tl, int tr){ if(tl == tr) { T[tl] = A[v]; return; } push(v); f(v+v,tl,tm); f(v+v+1,tm+1,tr); } void up(int v, int tl, int tr, int l, int r, int x, int h){ if(tl > r || tr < l) return; if(tl >= l && tr <= r){ if(h == 1) put1(v,x); else put2(v,x); return; } push(v); up(v+v,tl,tm,l,r,x,h); up(v+v+1,tm+1,tr,l,r,x,h); } void buildWall(int n, int k, int *op, int *lef, int *rig, int *hei, int *ans){ memset(B,22,sizeof B); int i; for(i=0;i<k;i++) up(1,0,n-1,lef[i],rig[i],hei[i],op[i]); f(1,0,n-1); for(i=0;i<n;i++) ans[i] = T[i]; }

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

wall.cpp: In function 'void f(int, int, int)':
wall.cpp:6:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl+tr >> 1)
             ~~^~
wall.cpp:25:23: note: in expansion of macro 'tm'
     push(v); f(v+v,tl,tm); f(v+v+1,tm+1,tr);
                       ^~
wall.cpp:6:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl+tr >> 1)
             ~~^~
wall.cpp:25:36: note: in expansion of macro 'tm'
     push(v); f(v+v,tl,tm); f(v+v+1,tm+1,tr);
                                    ^~
wall.cpp: In function 'void up(int, int, int, int, int, int, int)':
wall.cpp:6:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl+tr >> 1)
             ~~^~
wall.cpp:35:24: note: in expansion of macro 'tm'
     push(v); up(v+v,tl,tm,l,r,x,h); up(v+v+1,tm+1,tr,l,r,x,h);
                        ^~
wall.cpp:6:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl+tr >> 1)
             ~~^~
wall.cpp:35:46: note: in expansion of macro 'tm'
     push(v); up(v+v,tl,tm,l,r,x,h); up(v+v+1,tm+1,tr,l,r,x,h);
                                              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...