Submission #1098653

#TimeUsernameProblemLanguageResultExecution timeMemory
1098653vjudge1Wall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]){ long long int dp[n+5]; memset(dp,0,sizeof(dp)); for(int i=0;i<k;i++){ left[i]--,right[i]--; if(op[i]==1){ dp[left[i]]+=1LL*height[i],dp[right[i]+1]-=1LL*height[i]; }else{ dp[left[i]]-=1LL*height[i],dp[right[i]+1]+=1LL*height[i]; } }long long int cur = 0; for(int i=0;i<n;i++){ cur+=dp[i]; finalHeight[i]=cur; }return; }

Compilation message (stderr)

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:3:3: error: 'memset' was not declared in this scope
    3 |   memset(dp,0,sizeof(dp));
      |   ^~~~~~
wall.cpp:1:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
  +++ |+#include <cstring>
    1 | void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]){