Submission #337159

#TimeUsernameProblemLanguageResultExecution timeMemory
337159danielcm585Wall (IOI14_wall)C++14
Compilation error
0 ms0 KiB
#include "wall.h" #include <bits/stdc++.h> using namespace std; void buildWall(int n, int k, int op[], int left[], int right[], int height[], int final[]) { memset(final,0,sizeof(final)); for (int i = 0; i < k; i++) { for (int j = l[i]; j <= r[i]; j++) { if (op[i] == 1) final[j] = max(final[j],h[i]); else final[j] = min(final[j],h[i]); } } }

Compilation message (stderr)

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:7:32: warning: 'sizeof' on array function parameter 'final' will return size of 'int*' [-Wsizeof-array-argument]
    7 |     memset(final,0,sizeof(final));
      |                                ^
wall.cpp:6:83: note: declared here
    6 | void buildWall(int n, int k, int op[], int left[], int right[], int height[], int final[]) {
      |                                                                               ~~~~^~~~~~~
wall.cpp:7:20: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    7 |     memset(final,0,sizeof(final));
      |                    ^~~~~~~~~~~~~
wall.cpp:9:22: error: 'l' was not declared in this scope
    9 |         for (int j = l[i]; j <= r[i]; j++) {
      |                      ^
wall.cpp:9:33: error: 'r' was not declared in this scope
    9 |         for (int j = l[i]; j <= r[i]; j++) {
      |                                 ^
wall.cpp:10:53: error: 'h' was not declared in this scope
   10 |             if (op[i] == 1) final[j] = max(final[j],h[i]);
      |                                                     ^
wall.cpp:11:42: error: 'h' was not declared in this scope
   11 |             else final[j] = min(final[j],h[i]);
      |                                          ^