#121. 「离线可过」动态图连通性 (LCT维护删除时间最大的生成树)

博客探讨了如何使用LCT(线性时间复杂度树)数据结构在离线情况下维护动态图的连通性,并解决了一个相关问题,强调了LCT在处理某些问题上的效率。
摘要由CSDN通过智能技术生成

题目链接

题面:
在这里插入图片描述

题解:
人丑常数大。。。一个log的LCT,比两个log的线段树分治还要慢。

代码:

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<queue>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<list>
#include<ctime>
#define ui unsigned int
#define ll long long
#define llu unsigned ll
#define ld long double
#define pr make_pair
#define pb push_back
#define lc (cnt<<1)
#define rc (cnt<<1|1)
#define len(x)  (t[(x)].r-t[(x)].l+1)
#define tmid ((l+r)>>1)
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)>(y)?(y):(x))
using namespace std;

const int inf=0x3f3f3f3f;
const ll lnf=0x3f3f3f3f3f3f3f3f;
const double dnf=1e18;
const int mod=1e9+7;
const double eps=1e-1;
const double pi=acos(-1.0);
const int hp=13331;
const int maxn=550100;
const int maxp=800100;
const int maxm=1000100;
const int up=200000;

struct tree
{
   
    int son[2];
    int fa,minn,si,rev;
}t[maxn];

int st[maxn];
int deltime[maxn],isdel[maxn];
int n,m;
int idin[maxn];

struct node
{
   
    int x,y;
    int begintime,endtime;
    int id;
    node(){
   }
    node(int a,int b,int c,int d,int e)
    {
   
        x=a,y=b,begintime=c,endtime=d,id=e;
    }
}in[maxn],out[maxn];

bool cmpin(const node &a,const node &b)
{
   
    return a.begintime<b.begintime;
}
bool cmpout(const node &a,const node &b)
{
   
    return a.endtime<b.endtime;
}


struct nn
{
   
    int x,y,id;
    nn(){
   }
    nn(int a,int b,int c)
    {
   
        x=a,y=b,id=c;
    }
};

vector<nn>vc[maxn];
int ans[maxn];
map<pair<int,int>,int>mp;


void pushup(
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值