您的位置:首页 > 博客中心 > 互联网 >

CF375D Tree and Queries

时间:2022-05-08 05:33

树上莫队板子题,求个\(dfn\)求个\(low\)就行了。

#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define re register
#define ll long long
inline int gi(){
    int f=1,sum=0;char ch=getchar();
    while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
    return f*sum;
}
const int N=100010;
int front[N],cnt,bl[N],n,m,c[N],ans[N];
struct node{int to,nxt;}e[N<<1];
void Add(int u,int v){e[++cnt]=(node){v,front[u]};front[u]=cnt;}
struct point{
    int dfn,low,c;
    bool operator<(const point &b)const{return dfnq[i].l)Add(a[--l].c);
        while(rq[i].r)Del(a[r--].c);
        ans[q[i].id]=sum[q[i].k];
    }
    for(int i=1;i<=m;i++)printf("%d\n",ans[i]);
    return 0;
}

本类排行

今日推荐

热门手游