[树链剖分 李超线段树] BZOJ4515 [Sdoi2016] 游戏

链剖以后就跟数列的做法一样了

这题是区间覆盖区间查询,所以还要记一下区间里所有函数的最小值

#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const int N=100010;

int n,m,cnt,tt,G[N],dpt[N],id[N<<2];
ll k[N<<1],b[N<<1],dis[N],Mn[N<<2];
struct edge{
  int t,nx,w;
}E[N<<1];

inline char nc(){
  static char buf[100000],*p1=buf,*p2=buf;
  return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

inline void read(int &x){
  char c=nc(); x=0; int f=1;
  for(;c>'9'||c<'0';c=nc())f=c=='-'?-1:1;for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc()); x*=f;
}

inline void addedge(int x,int y,int z){
  E[++cnt].t=y; E[cnt].nx=G[x]; G[x]=cnt; E[cnt].w=z;
  E[++cnt].t=x; E[cnt].nx=G[y]; G[y]=cnt; E[cnt].w=z;
}

int fa[N],size[N],top[N],p[N],q[N],son[N];

void dfs1(int x,int f){
  fa[x]=f; dpt[x]=dpt[f]+1; size[x]=1;
  for(int i=G[x];i;i=E[i].nx)
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值