Submission #744579

#TimeUsernameProblemLanguageResultExecution timeMemory
744579vjudge1Wall (IOI14_wall)C++11
8 / 100
3061 ms18124 KiB
#include <bits/stdc++.h> #include "wall.h" using namespace std; const int MAX=1e5+10; const int INF=(1<<30); void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]) { memset(finalHeight,0,sizeof(finalHeight)); int niza[n]; memset(niza,0,sizeof(niza)); for(int i=0; i<k; i++) { int h=height[i]; if(op[i]==1) { for(int j=left[i]; j<=right[i]; j++) { if(niza[j]<h) { niza[j]=h; } } } else { for(int j=left[i]; j<=right[i]; j++) { if(niza[j]>h) { niza[j]=h; } } } } for(int i=0; i<n; i++) { finalHeight[i]=niza[i]; } return; } /*int main() { int n,k; cin>>n>>k; int op[k],left[k],right[k],height[k],res[n]; for(int i=0; i<k; i++) { cin>>op[i]>>left[i]>>right[i]>>height[i]; } buildWall(n,k,op,left,right,height, res); return 0; }*/

Compilation message (stderr)

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