# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1098638 | vjudge1 | Wall (IOI14_wall) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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;
}