割点判断+luogu 3469 POI2008 BLO】的更多相关文章

1.根节点,有2棵及以上子树 2.非根节点,有子节点dfn[u]<=low[v] #include <bits/stdc++.h> #define N 1000050 using namespace std; inline int read(){ ,f=;char ch=getchar(); ;ch=getchar();} )+(x<<)+(ch^);ch=getchar();} return x*f; } int head[N],dfn[N],low[N],cut[N];…
[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个点去掉…
题面 传送门:https://www.luogu.org/problemnew/show/P3469 Solution 先跟我大声念: poi! 然后开始干正事. 首先,我们先把题目中的点分为两类:去除这个点能把图分为几个部分的,去除这个点不影响整个图的连通性的. 如下图: 点上的数字表示这个点的搜索序. 我们称这些对连通性有影响的点为割点. 先假设我们能求出这些点以及其出去后把图分为几块之后那几块分别的大小. 是不是发现了什么? 对于非割点,答案显然是2*(n-1) (因为它不能影响别的点对连…
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个数,代表如果把…
1123: [POI2008]BLO Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 614  Solved: 235[Submit][Status] Description Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通. Input 输入n<=100000 m<=500000及m条边 Output 输出n个数,代表如果把第i个点去掉,将有多…
tarjan找割点..不是割点答案就是(N-1)*2, 是割点的话就在tarjan的时候顺便统计一下 ------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm>   using namespace std;   typedef long long ll;   co…
[POI2008]BLO Description Byteotia城市有\(n\)个 towns \(m\)条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通. Input 输入\(n<=100000\) \(m<=500000\)及\(m\)条边 Output 输出\(n\)个数,代表如果把第\(i\)个点去掉,将有多少对点不能互通. Sample Input 5 5 1 2 2 3 1 3 3 4 4 5 Sample Output…
#include <iostream> #include <cstring> #include <cstdio> using namespace std; typedef long long ll; ; ; int dfn[maxn], low[maxn], head[maxn]; ll ans[maxn], siz[maxn]; int n, m, tot, num, root; bool cut[maxn]; struct edge{ int to, next; }…
(上不了p站我要死了,侵权度娘背锅) Description Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通. Input 输入n<=100000 m<=500000及m条边 Output 输出n个数,代表如果把第i个点去掉,将有多少对点不能互通. Sample Input 5 5 1 2 2 3 1 3 3 4 4 5 Sample Output 8 8 16 14 8 很明显的判割点 写…
想了半天式子...最后在邓大师的帮助下想出此题....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…