BZOJ 1123:城市道路】的更多相关文章

Sol 就是求割点,把贡献算一下就好...直接tarjan # include <bits/stdc++.h> # define RG register # define IL inline # define Fill(a, b) memset(a, b, sizeof(a)) using namespace std; typedef long long ll; const int _(1e5 + 10); IL ll Read(){ RG ll x = 0, z = 1; RG char c…
1123: [POI2008]BLO Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 1030  Solved: 440[Submit][Status][Discuss] Description Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通. Input 输入n<=100000 m<=500000及m条边 Output 输出n个数,代表如果把…
tarjan找割点..不是割点答案就是(N-1)*2, 是割点的话就在tarjan的时候顺便统计一下 ------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm>   using namespace std;   typedef long long ll;   co…
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1123 [题目大意] Byteotia城市有n个towns,m条双向roads. 每条road连接两个不同的towns, 没有重复的road. 所有towns连通.输出n个数,代表如果把第i个点去掉,将有多少对点不能互通. [题解] Tarjan算法的基础应用,如果x是y分支的割点,那么y就参与x点的答案贡献计数, 将割点为x的不同分支的size进行动态乘即可. [代码] #inclu…
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1123 点双连通分量缩点,然后各种各样. 结果不会写了.比如新连边.记录一个点是割点缩成的点还是一块缩成的点什么的. 然后去学习了TJ.其实根本不用把缩点后的图真的建出来嘛!而且人家写得好好!唉,代码能力? #include<iostream> #include<cstdio> #include<cstring> #define ll long long using…
tarjan求割点计算答案.注意不是每一棵子树都算答案.开个变量记一下. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define maxv 100050 #define maxe 1000050 using namespace std; ,dfn[maxv],low[maxv],stack[maxv],top=,size[maxv],times=,,a…
#include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define pii pair<int,int> #define piii pair<int, pair<int,int> > using namespace std; ; + ; const int inf = 0x3f3f3f3f; const LL I…
[POI2008]BLO Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 1540  Solved: 711[Submit][Status][Discuss] Description Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通. Input 输入n<=100000 m<=500000及m条边 Output 输出n个数,代表如果把第i个点去掉…
想了半天式子...最后在邓大师的帮助下想出此题....QWQ我还是太菜了 对于一个非割点,ans+=2*(n-1); 对于一个割点,ans+= #include<cstdio> #include<iostream> #define R register int using namespace std; ,M=; inline int g() { R ret=,fix=; register :fix; +(ch^); while(isdigit(ch=getchar())); ret…
题目链接 题意:一张无向图,把第$i$个点关联的所有边去掉,求无向图中有多少个点对不连通. 题解: 如果割的不是割点,那么总答案是$2\times (n-1)$. 如果是割点,要分别考虑每个子树的贡献. #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; typedef long long ll; , M = 5e…