#include <bits/stdc++.h>
using namespace std;
#define maxn 50000+5
#define eps 1e-6
struct build
{
int l,h,r;
}b[maxn];
int t;
int h[maxn],ans[maxn];
int f(int k)
{
int res=0;
for(int i=0;i<t;i++)
{
if(b[i].l<=k && k<b[i].r)res=max(res,b[i].h);
}
return res;
}
int main()
{
int l=10001,r=-1;
while(~scanf("%d%d%d",&b[t].l,&b[t].h,&b[t].r))
{
l=min(l,b[t].l);
r=max(r,b[t].r);
t++;
}
for(int i=l;i<=r;i++)
{
h[i]=f(i);
// cout<<h[i]<<' ';
}
// return 0;
for(int i=1;i<r;i++)
{
if(h[i]!=h[i-1])
{
cout<<i<<' '<<h[i]<<' ';
}
}
cout<<r<<' '<<0<<endl;
return 0;
}
/*
1 11 5
2 6 7
3 13 9
12 7 16
14 3 25
19 18 22
23 13 29
24 4 28
*/
重点:楼房的l r h是指[l,r)的高度为h,这样分析更好(省的后面更新区间楼房高度麻烦)
我一开始是:[l,r]的高度为h,后面为了解决例如[22,23]这样的区间还分析了横坐标为22.5的高度……