/**
是男人就下100楼;
求到达底层的最大生命值。
一上来就TLE了,从高到低更新树,每次都维护落到[l,r]上的最大值,要更新到叶子结点才可以。
正解,从下到上更新树,想到与线段覆盖,找当前线段左右断点落下的线段的id值,
然后DP
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define N 100000
#define L(i) i << 1
#define R(i) i << 1 | 1
struct _st
{
int l,r,id;
int mid()
{
return (l + r) >> 1;
}
}st[N<<2];
struct _seg
{
int x1,x2,h,val;
void input()
{
scanf("%d%d%d%d",&h,&x1,&x2,&val);
}
}seg[N];
int dp[N];
bool cmp(_seg a,_seg b)
{
return a.h < b.h;
}
void build(int id,int l,int r)
{
st[id].l = l;
st[id].r =
hdu 3016 #线段树 #线段覆盖
最新推荐文章于 2018-05-20 12:28:34 发布