제출 #1362991

#제출 시각아이디문제언어결과실행 시간메모리
1362991nicolo_010벽 (IOI14_wall)C++20
컴파일 에러
0 ms0 KiB
#include "wall.h"

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int final[]){
    for (int i=0; i<n; i++) {
        final[i] = 0;
    }
    for (int i=0; i<k; i++) {
        int t = op[i];
        for (int j=left[i]; j<=right[i]; j++) {
            if (t==1) {
                final[i] = max(final[i], height[i]);
            }
            else {
                final[i] = min(final[i], height[i]);
            }
        }
    }
    return;
}

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

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:11:28: error: 'max' was not declared in this scope
   11 |                 final[i] = max(final[i], height[i]);
      |                            ^~~
wall.cpp:14:28: error: 'min' was not declared in this scope
   14 |                 final[i] = min(final[i], height[i]);
      |                            ^~~