HDU – 1754 I Hate It(线段树)
HDU - 1754 I Hate It(线段树)
#include
using namespace std;
const int N =200010;
int n,m,s[N];
struct Node
{
int l,r,v;
}tr[N*4];
inline void pushup(int u)
{
tr[u].v=max(tr[u<<1].v,tr[u<<1|1].v);
}
inline void build(int u,int l,int r)
{
if(l==r)
{
tr[u]=(Node){l,r,s[l]};
return ;
}
else
{
tr[u]=(Node){l,r,0};
int mid=(l+r)>>1;
build(u<<1,l,mid),build(u
共有 0 条评论