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;
#define clamp(x,l,r) x=min(r,max(x,l))
#define all(x) begin(x),end(x)
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
vector<int> wall(n,0);
for(int i = 0; i < k; i++)
{
auto t = op[i];
int l = left[i];
int r = right[i];
int val = height[i];
if(t==1) for(int j = l; j <= r; j++) wall[j] = max(wall[j],val);
else for(int j = l; j <= r; j++) wall[j] = min(wall[j],val);
}
for(auto i : wall) *finalHeight++ = i;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |