#include "wall.h"
#include <bits/stdc++.h>
#define lli long long int
#define rep(i,a,b) for (lli i = (a); i <= (b); i++)
#define MIN -100001
using namespace std;
struct x{
lli pos;
lli tipo;
lli val;
bool operator < (const x &a)
const {
return pos < a.pos;
}
};
set<lli> set1,set2;
vector<x> sum,res;
lli cant1[100002],cant2[100002];
lli cont1,cont2,a,b;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
rep(i,0,k-1) {
if (op[i] == 1) {
rep(j,left[i],right[i]) if (finalHeight[j] < height[i]) finalHeight[j] = height[i];
}
else {
rep(j,left[i],right[i]) if (finalHeight[j] > height[i]) finalHeight[j] = height[i];
}
}
return;
}