제출 #260665

#제출 시각아이디문제언어결과실행 시간메모리
260665A02벽 (IOI14_wall)C++14
컴파일 에러
0 ms0 KiB
#include "wall.h" #include <iostream> #include <vector> #include <algorithm> #include <utility> #include <set> void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ for (int i = 0; i < n; i++){ finalHeight[i] = 0; } for (int i = 0; i < k; i++){ for (int x = left[i]; x <= right[i]; x++){ if (op[i] == 1){ finalHeight[x] = max(finalHeight[i], height[i]); } else { finalHeight[x] = min(finalHeight[i], height[i]); } } } return; }

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

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:16:34: error: 'max' was not declared in this scope
                 finalHeight[x] = max(finalHeight[i], height[i]);
                                  ^~~
wall.cpp:16:34: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from wall.cpp:4:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
wall.cpp:18:34: error: 'min' was not declared in this scope
                 finalHeight[x] = min(finalHeight[i], height[i]);
                                  ^~~
wall.cpp:18:34: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from wall.cpp:4:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~