Submission #290255

# Submission time Handle Problem Language Result Execution time Memory
290255 2020-09-03T14:47:47 Z AaronNaidu Wall (IOI14_wall) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.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 i = 0; i < k; i++)
    {
        if (op == 1)
        {
            for (int j = left[i]; j < right[i]; j++)
            {
                finalHeight[j] = max(finalHeight[j], heights[i]);
            }
        }
        else
        {
            for (int j = left[i]; j < right[i]; j++)
            {
                finalHeight[j] = min(finalHeight[j], heights[i]);
            }
        }
    }
}

Compilation message

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:12:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |         if (op == 1)
      |                   ^
wall.cpp:16:54: error: 'heights' was not declared in this scope; did you mean 'height'?
   16 |                 finalHeight[j] = max(finalHeight[j], heights[i]);
      |                                                      ^~~~~~~
      |                                                      height
wall.cpp:23:54: error: 'heights' was not declared in this scope; did you mean 'height'?
   23 |                 finalHeight[j] = min(finalHeight[j], heights[i]);
      |                                                      ^~~~~~~
      |                                                      height