Submission #337096

#TimeUsernameProblemLanguageResultExecution timeMemory
337096blueWall (IOI14_wall)C++11
Compilation error
0 ms0 KiB
#include "wall.h"
using namespace std;

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 q = 0; q < k; q++)
    {
        if(op[q] == 1)
        {
            for(int i = left[q]; i <= right[q]; i++) finalHeight[i] = max(finalHeight[i], height[q]);
        }
        else
        {
            for(int i = left[q]; i <= right[q]; i++) finalHeight[i] = min(finalHeight[i], height[q]);
        }
    }
}

Compilation message (stderr)

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:12:71: error: 'max' was not declared in this scope
   12 |             for(int i = left[q]; i <= right[q]; i++) finalHeight[i] = max(finalHeight[i], height[q]);
      |                                                                       ^~~
wall.cpp:16:71: error: 'min' was not declared in this scope
   16 |             for(int i = left[q]; i <= right[q]; i++) finalHeight[i] = min(finalHeight[i], height[q]);
      |                                                                       ^~~