# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733533 | Julto | 벽 (IOI14_wall) | C++14 | 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.
#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[]){
for(int i = 0; i < k; i++){
for(int j = left[i]; j <= right[i]; j++){
if(op[i] == 1){
finalHeight[j] = max(height[i], finalHeight[j]);
}
else{
finalHeight[j] = min(height[i], finalHeight[j]);
}
}
}
/*for(int i = 0; i < n; i++){
cout << finalHeight[i] << " ";
}*/
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k; n = 4, k = 5;
int left[] = {0, 1, 1, 0, 2}, right[] = {3, 2, 1, 1, 3},
height[] = {2, 1, 3, 4, 10}, op[] = {1, 2, 1, 2, 1}, finalHeight[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
buildWall(n, k, op, left, right, height, finalHeight);
}