Submission #478240

#TimeUsernameProblemLanguageResultExecution timeMemory
478240PiejanVDC벽 (IOI14_wall)C++17
8 / 100
3067 ms18324 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 finalHeight[]) { memset(finalHeight,0,sizeof(finalHeight)); for(int i = 0 ; i < k ; i++) { if(op[i] == 1) { for(int p = left[i] ; p <= right[i] ; p++) { finalHeight[p] = max(height[i],finalHeight[p]); } } else { for(int p = left[i] ; p <= right[i] ; p++) { finalHeight[p] = min(height[i],finalHeight[p]); } } } }

Compilation message (stderr)

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:6:33: warning: 'sizeof' on array function parameter 'finalHeight' will return size of 'int*' [-Wsizeof-array-argument]
    6 |     memset(finalHeight,0,sizeof(finalHeight));
      |                                ~^~~~~~~~~~~~
wall.cpp:5:83: note: declared here
    5 | void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]) {
      |                                                                               ~~~~^~~~~~~~~~~~~
wall.cpp:6:26: 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]
    6 |     memset(finalHeight,0,sizeof(finalHeight));
      |                          ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...