답안 #1098638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1098638 2024-10-09T16:18:32 Z vjudge1 벽 (IOI14_wall) C++17
컴파일 오류
0 ms 0 KB
void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]){
  vector<long long int>dp(n+5,0);
  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

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:2:3: error: 'vector' was not declared in this scope
    2 |   vector<long long int>dp(n+5,0);
      |   ^~~~~~
wall.cpp:2:10: error: expected primary-expression before 'long'
    2 |   vector<long long int>dp(n+5,0);
      |          ^~~~
wall.cpp:6:7: error: 'dp' was not declared in this scope; did you mean 'op'?
    6 |       dp[left[i]]+=1LL*height[i],dp[right[i]+1]-=1LL*height[i];
      |       ^~
      |       op
wall.cpp:8:7: error: 'dp' was not declared in this scope; did you mean 'op'?
    8 |       dp[left[i]]-=1LL*height[i],dp[right[i]+1]+=1LL*height[i];
      |       ^~
      |       op
wall.cpp:12:10: error: 'dp' was not declared in this scope; did you mean 'op'?
   12 |     cur+=dp[i];
      |          ^~
      |          op