先来%一下Robert Tarjan前辈

%%%%%%%%%%%%%%%%%%

然后是热情感谢下列并不止这些大佬的博客:

图连通性(一):Tarjan算法求解有向图强连通分量

图连通性(二):Tarjan算法求解割点/桥/双连通分量/LCA

初探tarjan算法(求强连通分量)

关于Tarjan算法求点双连通分量

图的割点、桥与双连通分支

感谢有各位大佬的博客帮助我理解和学习,接下来就是进入正题。

关于tarjan,之前我写过一个是求lca的随笔,而找lca只是它一个小小的功能,它还有很多其他功能,具体是什么,我就根据自己的学习进程,一步步来自我回忆一下。

第一个是有向图求强连通分量。

让我们来引进百度

有向图强连通分量:在有向图G中,如果两个顶点vi,vj间(vi>vj)有一条从vi到vj的有向路径,同时还有一条从vj到vi的有向路径,则称两个顶点强连通(strongly connected)。如果有向图G的每两个顶点都强连通,称G是一个强连通图。有向图的极大强连通子图,称为强连通分量(strongly connected components)。

 通俗解释,强连通就是有向图中,任意两个顶点彼此有一条路可以可以走到,而强连通分量就是它的强连通子图,极大强连通分量就是它最大的那个强连通子图。
而详细步骤的话,上面的博客已经讲得很清楚了,我就简单的阐述一下步骤。
首先便是遍历没被访问过的点,然后对它进行访问,dfn就代表着一个访问时间戳,类似dfs序,然后low其实就是从这个点能够走到的点的最小的时间戳。
对于每个点u,我们把它压入栈中,然后去访问它能够走到的点v,同时更新它的low值,这里的话,如果是u->v树枝边,用low[v]更新,u->v是后向边并且v在栈中的话,用dfn[v]更新。
因为遍历的时候,类似树的遍历,u->v为树枝边的话,类似v在u的子树里。u->v是后向边的话,类似v是u的祖先或者是被u子树里其他点遍历过的,如果不在栈中的话,说明v是其他强连通分量的了,就不能再用它来更新u。
当tarjan回溯到u这个节点时,如果dfn[u]==low[u],则说明存在一个强连通分量,就把栈中点一直弹出一直到点u,这些点就属于同一个强连通分量。
因为dfn[u]==low[u]的话,说明u走回不到它的祖先,而栈顶一直到u的点,是u能走到的点,而回溯到u,它们还在栈中,说明它们也能走到u,所以这些都是彼此可达的点,也就是一个强连通分量。
然后强连通分量缩点的话,就是把在同一强通分量的点染色。
 接下来直接做些题来找一找感觉吧。

迷宫城堡

HDU - 1269

题意:问任意两个房间是不是连通的。
就直接求强连通分量是不是只有一个。
 #include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e4+,M=1e5+;
struct Side{
int v,ne;
}S[M];
bool ins[N],in[N],out[N];
int n,sn,dn,tn,head[N],dfn[N],low[N],sta[N];
int cn,col[N];
void init(){
sn=dn=tn=cn=;
for(int i=;i<=n;i++){
head[i]=-;
dfn[i]=;
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void tarjan(int u){
ins[u]=true;
sta[++tn]=u;
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}else if(ins[v]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]){
col[u]=++cn;
ins[u]=false;
while(sta[tn]!=u){
col[sta[tn]]=cn;
ins[sta[tn--]]=false;
}
tn--;
}
}
int main(){
int m,u,v;
while(scanf("%d%d",&n,&m)&&(n||m)){
init();
while(m--){
scanf("%d%d",&u,&v);
add(u,v);
}
for(int i=;i<=n;i++) if(!dfn[i]) tarjan(i);
if(cn==) puts("Yes");
else puts("No");
}
return ;
}

迷宫

P2863牛的舞会The Cow Prom

题意:两只牛通过绳子连起来,一个牛能不能跳圆舞就是看顺着绳子的方向,能不能回到它。一只牛是跳不了圆舞的,问能跳圆舞的牛的组合有多少组。

就求点数大于的强连通分量个数。

 #include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e4+,M=5e4+;
struct Side{
int v,ne;
}S[M];
bool ins[N];
int sn,dn,tn,ans,head[N],dfn[N],low[N],sta[N];
void init(int n){
sn=dn=tn=ans=;
sta[]=-;
for(int i=;i<=n;i++){
dfn[i]=;
head[i]=-;
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void tarjan(int u){
ins[u]=true;
sta[++tn]=u;
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}else if(ins[v]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]){
int num=;
ins[u]=false;
while(sta[tn]!=u){
num++;
ins[sta[tn--]]=false;
}
if(num>) ans++;
tn--;
}
}
int main(){
int n,m,u,v;
while(~scanf("%d%d",&n,&m)){
init(n);
for(int i=;i<m;i++){
scanf("%d%d",&u,&v);
add(u,v);
}
for(int i=;i<=n;i++) if(!dfn[i]) tarjan(i);
printf("%d\n",ans);
}
return ;
}

牛牛牛

P1726 上白泽慧音

题意:求最大的强连通分量,多个的话输出字典序最小的。

一个节点只会属于一个连通块,直接记录强连通记录和最小的节点编号,然后把同一个强连通的节点染色一下,由小到大把属于答案那个强连通分量的节点编号输出。

 #include<cstdio>
#include<algorithm>
using namespace std;
const int N=5e3+,M=5e4+;
struct Side{
int v,ne;
}S[M<<];
bool ins[N];
int n,sn,tn,dn,head[N],dfn[N],low[N],sta[N];
int cn,ansc,col[N],size[N],minc[N];
void init(){
sn=dn=tn=cn=;
ansc=;
for(int i=;i<=n;i++){
dfn[i]=;
size[i]=;
minc[i]=n+;
head[i]=-;
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void tarjan(int u){
ins[u]=true;
sta[++tn]=u;
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}else if(ins[v]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]){
col[u]=++cn;
ins[u]=false;
size[cn]=;
minc[cn]=u;
while(sta[tn]!=u){
col[sta[tn]]=cn;
size[cn]++;
minc[cn]=min(minc[cn],sta[tn]);
ins[sta[tn--]]=false;
}
if(size[cn]>size[ansc]||(size[cn]==size[ansc]&&minc[cn]<minc[ansc])) ansc=cn;
tn--;
}
}
int main(){
int m,u,v,op;
while(~scanf("%d%d",&n,&m)){
init();
while(m--){
scanf("%d%d%d",&u,&v,&op);
add(u,v);
if(op==) add(v,u);
}
for(int i=;i<=n;i++) if(!dfn[i]) tarjan(i);
printf("%d\n",size[ansc]);
int kg=;
for(int i=;i<=n;i++) if(col[i]==ansc){
if(kg) printf(" ");
kg=;
printf("%d",i);
}
printf("\n");
}
return ;
}

上白泽??

 Proving EquivalencesHDU - 2767

题意:a公式能推导b,b能推导c,c能推导a,说明3个等式的等价的,给出n个公式,和m个推导关系,问最少加多少个推导,使得属于公式等价。

其实就是要最少加多少条边使得整个图是强连通的,原图中是有环的,所以我们就用tarjan先把强连通缩点,然后的话,就是一个有向无环图了,那怎么使得我们要使得这个图是强连通的话,其实就是看入度为0和出度为0的点

因为要能到其他点和能被其他点到达,所以肯定要有出有入,那就是出度为0的可以向入度为0的点连一条边,剩下的可以任意连或者自环,答案也就是出度和入度为0的点中,点数更多的那个,还有就是只有一个点的是0,不是1.。。。

 #include<cstdio>
#include<algorithm>
using namespace std;
const int N=2e4+,M=5e4+;
struct Side{
int v,ne;
}S[M];
bool ins[N],in[N],out[N];
int n,sn,dn,tn,head[N],dfn[N],low[N],sta[N];
int cn,col[N];
void init(){
sn=dn=tn=cn=;
for(int i=;i<=n;i++){
head[i]=-;
dfn[i]=;
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void tarjan(int u){
ins[u]=true;
sta[++tn]=u;
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}else if(ins[v]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]){
col[u]=++cn;
ins[u]=false;
while(sta[tn]!=u){
col[sta[tn]]=cn;
ins[sta[tn--]]=false;
}
tn--;
}
}
int solve(){
if(cn==) return ;
for(int i=;i<=cn;i++) in[i]=out[i]=false;
int ci,cj;
for(int i=;i<=n;i++){
ci=col[i];
for(int j=head[i];~j;j=S[j].ne){
cj=col[S[j].v];
if(ci!=cj){
out[ci]=true;
in[cj]=true;
}
}
}
int noi=,noo=;
for(int i=;i<=cn;i++){
if(!in[i]) noi++;
if(!out[i]) noo++;
}
return max(noi,noo);
}
int main(){
int t,m,u,v;
scanf("%d",&t);
while(t--){
scanf("%d%d",&n,&m);
init();
while(m--){
scanf("%d%d",&u,&v);
add(u,v);
}
for(int i=;i<=n;i++) if(!dfn[i]) tarjan(i);
printf("%d\n",solve());
}
return ;
}

公式啊

Summer HolidayHDU - 1827

题意:听说lcy帮大家预定了新马泰7日游,Wiskey真是高兴的夜不能寐啊,他想着得快点把这消息告诉大家,虽然他手上有所有人的联系方式,但是一个一个联系过去实在太耗时间和电话费了。他知道其他人也有一些别人的联系方式,这样他可以通知其他人,再让其他人帮忙通知一下别人。你能帮Wiskey计算出至少要通知多少人,至少得花多少电话费就能让所有人都被通知到吗?

就先把强连通缩点,这个点的贡献就是整个强连通里权值最小的那个,然后的话就是看入度为0的点的贡献,因为他们没有人通知,肯定只能由wis通知。

 //把每个环缩点,统计每个环的最小贡献
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e3+,M=2e3+;
struct Side{
int v,ne;
}S[M];
bool ins[N],in[N];
int n,sn,dn,tn,head[N],dfn[N],low[N],sta[N];
int cn,col[N],minc[N],cost[N];
void init(){
sn=dn=tn=cn=;
for(int i=;i<=n;i++){
head[i]=-;
dfn[i]=;
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void tarjan(int u){
ins[u]=true;
sta[++tn]=u;
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}else if(ins[v]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]){
col[u]=++cn;
ins[u]=false;
minc[cn]=cost[u];
while(sta[tn]!=u){
col[sta[tn]]=cn;
minc[cn]=min(minc[cn],cost[sta[tn]]);
ins[sta[tn--]]=false;
}
tn--;
}
}
void solve(){
for(int i=;i<=cn;i++) in[i]=false;
int ci,cj;
for(int i=;i<=n;i++){
ci=col[i];
for(int j=head[i];~j;j=S[j].ne){
cj=col[S[j].v];
if(ci!=cj) in[cj]=true;
}
}
int ans1=,ans2=;
for(int i=;i<=cn;i++) if(!in[i]) ans1++,ans2+=minc[i];
printf("%d %d\n",ans1,ans2);
}
int main(){
int m,u,v;
while(~scanf("%d%d",&n,&m)){
init();
for(int i=;i<=n;i++) scanf("%d",&cost[i]);
while(m--){
scanf("%d%d",&u,&v);
add(u,v);
}
for(int i=;i<=n;i++) if(!dfn[i]) tarjan(i);
solve();
}
return ;
}

我也想罗马游

Intelligence SystemHDU - 3072

题意:要把一个情报通知给所有人,彼此能通知到的人属于同一分支,一个人通知跟他同一分支的人不需要花费,否则就有一个花费,求通知所有人的最小花费。

也先强连通缩点,然后的话就是更新一下通知到这个点的最小花费。

 #include<cstdio>
#include<algorithm>
using namespace std;
const int N=5e4+,M=1e5+,inf=1e9+;
struct Side{
int v,ne,w;
}S[M];
bool ins[N];
int n,sn,dn,tn,head[N],dfn[N],low[N],sta[N];
int cn,col[N],minc[N];
void init(){
sn=dn=tn=cn=;
for(int i=;i<=n;i++){
head[i]=-;
dfn[i]=;
}
}
void add(int u,int v,int w){
S[sn].w=w;
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void tarjan(int u){
ins[u]=true;
sta[++tn]=u;
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}else if(ins[v]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]){
col[u]=++cn;
ins[u]=false;
while(sta[tn]!=u){
col[sta[tn]]=cn;
ins[sta[tn--]]=false;
}
tn--;
}
}
void solve(){
for(int i=;i<=cn;i++) minc[i]=inf;
int ci,cj;
for(int i=;i<n;i++){
ci=col[i];
for(int j=head[i];~j;j=S[j].ne){
cj=col[S[j].v];
if(ci!=cj) minc[cj]=min(minc[cj],S[j].w);
}
}
long long ans=;
for(int i=;i<=cn;i++) if(minc[i]!=inf) ans+=minc[i];
printf("%lld\n",ans);
}
int main(){
int m,u,v,w;
while(~scanf("%d%d",&n,&m)){
init();
while(m--){
scanf("%d%d%d",&u,&v,&w);
add(u,v,w);
}
for(int i=;i<n;i++) if(!dfn[i]) tarjan(i);
solve();
}
return ;
}

人传人二毛五

P3387 【模板】缩点

题意:给定一个n个点m条边有向图,每个点有一个权值,求一条路径,使路径经过的点权值之和最大。你只需要求出这个权值和。允许多次经过一条边或者一个点,但是,重复经过的点,权值只计算一次。

先缩点,然后重新建图就是一个有向无环图了,找到入度为0的点,由它开始dp每个点,更新走到这个点的最大权值,然后最后取一下答案最大值

 #include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N=1e4+,M=1e5+;
struct Side{
int v,ne;
}S[M];
bool ins[N];
int n,sn,dn,tn,head[N],dfn[N],low[N],sta[N];
int cn,col[N],val[N],ww[N],in[N],dp[N];
vector<int> vv[N];
void init(){
sn=dn=tn=cn=;
for(int i=;i<=n;i++){
dfn[i]=;
val[i]=;
head[i]=-;
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void tarjan(int u){
ins[u]=true;
sta[++tn]=u;
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}else if(ins[v]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]){
col[u]=++cn;
val[cn]=ww[u];
ins[u]=false;
while(sta[tn]!=u){
col[sta[tn]]=cn;
val[cn]+=ww[sta[tn]];
ins[sta[tn--]]=false;
}
tn--;
}
}
void dfs(int u){
int v,usize=vv[u].size();
for(int i=;i<usize;i++){
v=vv[u][i];
dp[v]=max(dp[v],dp[u]+val[u]);
dfs(v);
}
}
int solve(){
for(int i=;i<=cn;i++){
in[i]=;
dp[i]=;
vv[i].clear();
}
int cu,cv,ans=;
for(int i=;i<=n;i++){
cu=col[i];
for(int j=head[i];~j;j=S[j].ne){
cv=col[S[j].v];
if(cu!=cv){
in[cv]++;
vv[cu].push_back(cv);
}
}
}
for(int i=;i<=cn;i++) if(!in[i]) dfs(i);
for(int i=;i<=cn;i++) ans=max(ans,dp[i]+val[i]);
return ans;
}
int main(){
int m,u,v;
while(~scanf("%d%d",&n,&m)){
init();
for(int i=;i<=n;i++) scanf("%d",&ww[i]);
while(m--){
scanf("%d%d",&u,&v);
add(u,v);
}
for(int i=;i<=n;i++) if(!dfn[i]) tarjan(i);
printf("%d\n",solve());
}
return ;
}

dpppp

强连通的题找的比较多,所以多弄几题,可以看见板子题就是板子题,套就完事了。

然后就是在无向图中的了,割点,桥,点(边)双连通分量。

直接引用一下上面大佬博客的

1.割点:若删掉某点后,原连通图分裂为多个子图,则称该点为割点。

2.割点集合:在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。

3.点连通度:最小割点集合中的顶点数。

4.割边(桥):删掉它之后,图必然会分裂为两个或两个以上的子图。

5.割边集合:如果有一个边集合,删除这个边集合以后,原图变成多个连通块,就称这个点集为割边集合。

6.边连通度:一个图的边连通度的定义为,最小割边集合中的边数。

7.缩点:把没有割边的连通子图缩为一个点,此时满足任意两点之间都有两条路径可达。

注:求块<>求缩点。缩点后变成一棵k个点k-1条割边连接成的树。而割点可以存在于多个块中。

8.双连通分量:分为点双连通和边双连通。它的标准定义为:点连通度大于1的图称为点双连通图,边连通度大于1的图称为边双连通图。通俗地讲,满足任意两点之间,能通过两条或两条以上没有任何重复边的路到达的图称为双连通图。无向图G的极大双连通子图称为双连通分量。

通俗解释就是。。没有啥通俗解释,上面的定义就是相应的意思。

那我们就是来一个个来说一下怎么求,首先说明,tarjan算法求得的东西是各个连通块的东西,所以要是要求的原图的东西的话,还需要判连通来判断一下。

然后我们就先来说一个割点怎么求。

首先跟求强连通分量差不多,我们还是得把没访问的点遍历一遍,然后像树的遍历一样去访问这个点以及它能走到的那些点,去更新low,但不需要把点压入栈中,也就是如果v是u的祖先,直接更新low,不用判断在不在栈里(因为压根没有)

然后当我们遍历完u的下一节点v,回溯到u时,如果low[v]>=dfn[u]的话,不就说明,v没法走到u的祖先。所以把u割去,必定分成多个连通块,所以u就是割点。

不过这里得判断u是不是根节点,也就是用来一开始遍历的那个节点,因为像1->2,2->3,3->1的话,用1来作为根节点,也有low[2]>=dfn[1],但1不是割点

那根节点是不是割点怎么判断呢,也就是看一下它能访问到的连通块有多少个,如果是大于等于两个的话,那它很明显也是割点了。

我最喜欢的做题实战环节。

P3388 【模板】割点(割顶)

题意:给出一个nn个点,mm条边的无向图,求图的割点。

割点模板题,原图不一定连通,要求的是各个连通块的割点。

 #include<cstdio>
#include<vector>
using namespace std;
const int N=2e4+;
bool isc[N];
int n,dn,dfn[N],low[N];
vector<int> vv[N];
int ans;
void init(int n){
dn=;
for(int i=;i<=n;i++){
dfn[i]=;
isc[i]=false;
vv[i].clear();
}
}
void findc(int u,int fa){
dfn[u]=low[u]=++dn;
int v,vvs=vv[u].size(),son=;
for(int i=;i<vvs;i++){
v=vv[u][i];
if(!dfn[v]){
if(u==fa) son++;
findc(v,u);
low[u]=min(low[u],low[v]);
if(low[v]>=dfn[u]&&u!=fa) isc[u]=true;
}else low[u]=min(low[u],dfn[v]);
}
if(u==fa&&son>=) isc[u]=true;
if(isc[u]) ans++;
}
int main(){
int n,m,u,v;
while(~scanf("%d%d",&n,&m)){
init(n);
while(m--){
scanf("%d%d",&u,&v);
vv[u].push_back(v);
vv[v].push_back(u);
}
ans=;
for(int i=;i<=n;i++) if(!dfn[i]) findc(i,i);
printf("%d\n",ans);
int kg=;
for(int i=;i<=n;i++) if(isc[i]){
if(kg) printf(" ");
kg=;
printf("%d",i);
}
printf("\n");
}
return ;
}

板子呀

SPFPOJ - 1523

题意:如果一个节点如果它不可用了,将阻止至少一对可用节点能够在先前完全连接的网络上进行通信,那么它是SPF,求哪些节点是SPF,并且它故障后留下几个子网。

也是割点模板题,子网其实就是连通块,对于一个割点来说,它割掉之后产生的连通块就是能让它是割点的点个数,因为那些点就代表着它那个连通块。

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N=1e3+;
int dn,dfn[N],low[N],cut[N];
vector<int> vv[N];
void init(int n){
dn=;
for(int i=;i<=;i++){
cut[i]=;
dfn[i]=;
vv[i].clear();
}
}
void findc(int u,int fa){
dfn[u]=low[u]=++dn;
int v,son=,vvs=vv[u].size();
for(int i=;i<vvs;i++){
v=vv[u][i];
if(!dfn[v]){
if(u==fa) son++;
findc(v,u);
low[u]=min(low[u],low[v]);
if(low[v]>=dfn[u]) cut[u]++;
}else low[u]=min(low[u],dfn[v]);
}
if(u==fa) cut[u]=son-;
}
int main(){
int u,v=,t=;
init();
while(~scanf("%d",&u)){
if(u){
scanf("%d",&v);
vv[u].push_back(v);
vv[v].push_back(u);
}
else{
if(!v) break;
for(int i=;i<=;i++) if(!dfn[i]) findc(i,i);
printf("Network #%d\n",t++);
int num=;
for(int i=;i<=;i++) if(cut[i]>){
num++;
printf(" SPF node %d leaves %d subnets\n",i,cut[i]+);
}
if(num==) printf(" No SPF nodes\n");
printf("\n");
init();
v=;
}
}
return ;
}

SPF

然后从割点也可以看出桥(割边)怎么求了,其他一样,不同的是后向边的话不是u才更新,然后判断一下low[v]>dfn[u],这样的话v连u都访问不到,说明u->v割去,必定分成多个连通块,所以u->v就是桥。

但其实这里面还有一个问题,这是建立在没有重边的情况下,有重边的话像1->2 1->2 明显1->2不是割边,但是用上面方法1->2是割边,所以有割边的话需要先进行预处理一下。

但也有不需要预处理的方法,就上面博客有提到,我直接引用一下

我们记录每条边的标号(一条无向边拆成的两条有向边标号相同),记录每个点的父亲到它的边的标号,如果边(u,v)是v的父亲边,就不能用dfn[u]更新low[v]。这样如果遍历完v的所有子节点后,发现low[v]=dfn[v],说明u的父亲边(u,v)为割边。

这样我们通过记录边的编号就很好判断了重边。

Caocao's BridgesHDU - 4738

题意:人妻操在海上弄了些小岛,彼此用桥连接,周瑜只有一个炸弹,要派人去把一个桥炸了,使得所有小岛分成几个连通块,桥上有守卫,派的人不能少于守卫数,问最少派多少人,或者根本不可能完成任务。

就是找权值最小的桥,但是要的是整个图的,所以如果一开始就不连通的话,就不需要派人了,这个没注意到wrong了几发,然后还有就是如果权值最小的是0,也得派一个人。

 #include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e3+,M=1e6+;
struct Side{
int v,ne,id;
}S[M<<];
int ans;
int n,sn,dn,head[N],dfn[N],low[N],fp[N],fa[N],val[M];
void init(){
sn=dn=;
for(int i=;i<=n;i++){
fa[i]=i;
fp[i]=-;
dfn[i]=;
head[i]=-;
}
}
void add(int u,int v,int id){
S[sn].id=id;
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
int find(int x){
return fa[x]==x ? x : fa[x]=find(fa[x]);
}
void bing(int x,int y){
int fx=find(x),fy=find(y);
if(fx!=fy) fa[fx]=fy;
}
void findq(int u){
dfn[u]=low[u]=++dn;
int v,id;
for(int i=head[u];~i;i=S[i].ne){
v=S[i].v;
id=S[i].id;
if(!dfn[v]){
fp[v]=id;
findq(v);
low[u]=min(low[u],low[v]);
}else if(id!=fp[u]) low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u]&&fp[u]!=-){
if(ans==-) ans=val[fp[u]];
else ans=min(ans,val[fp[u]]);
}
}
int main(){
int m,u,v,w;
while(~scanf("%d%d",&n,&m)&&(n||m)){
init();
while(m--){
scanf("%d%d%d",&u,&v,&w);
val[m]=w;
add(u,v,m);
add(v,u,m);
bing(u,v);
}
ans=-;
int flag=,beg=;
for(int i=;i<=n;i++) if(fa[i]==i){
if(beg){
flag=;
break;
}
beg=i;
}
if(!flag){
printf("0\n");
continue;
}
findq(beg);
if(!ans) ans++;
printf("%d\n",ans);
}
return ;
}

浪花淘尽英雄

桥的话直接求的比较少,一般是用在求边双连通上。

求点双连通的话,网上的写法太多了,而且不一致,我最后选择了我认为比较对的写法。

对于点双连通分支,实际上在求割点的过程中就能顺便把每个点双连通分支求出。建立一个栈,存储当前双连通分支,在搜索图时,每找到一条树枝边或后向边(非横叉边),就把这条边加入栈中。如果遇到某时满足DFS(u)<=Low(v),说明u是一个割点,同时把边从栈顶一个个取出,直到遇到了边(u,v),取出的这些边与其关联的点,组成一个点双连通分支。割点可以属于多个点双连通分支,其余点和每条边只属于且属于一个点双连通分支。

但其中,DFS(u)<=Low(v),说明u是一个割点的话,跟上面的求割点的说法冲突了,这里我也是满疑惑的,等着可爱的你们给我解惑。

Knights of the Round TablePOJ - 2942

题意:圆桌会议,每个骑士周围坐着两个骑士,彼此有仇的骑士不能坐在周围,开会的骑士的人数得是大于等于3的奇数,问怎么也开不了会的骑士有几个。

这题嘛,就首先,。。。点开题解。。。我是真没想到怎么是点双连通。

然后看完题解之后,我们领悟了,首先每个骑士周围都坐着两个人,然后是围成一个圈,其实这就是个点双连通,每个骑士彼此可达,所以题目也就是求多少个其实不能出现在双连通的奇圈里。(奇圈就是点数是奇数的圈)

这里是有个结论的,如果一个双连通分量内的某些顶点在一个奇圈中(即双连通分量含有奇圈),那么这个双连通分量的其他顶点也在某个奇圈中证明就不证明了,反正我不会,一句话,记住就好。

然后怎么判断有没有奇圈呢,一个图是二分图当且仅当图中不存在奇圈,所以反过来直接判断这个双连通是不是二分图就好了,判断二分图的话就是染色法。

 #include<cstdio>
#include<vector>
#include<stack>
#include<algorithm>
using namespace std;
const int N=1e3+,M=1e6+;
struct Side{
int u,v,ne;
Side(){}
Side(int u,int v):u(u),v(v){}
}S[M<<];
bool hate[N][N],book[N],expel[N];
int n,sn,dn,bn,head[N],dfn[N],low[N],col[N],bin[N];
stack<Side> sta;
vector<int> bb[N];
void init(){
sn=dn=bn=;
while(sta.size()) sta.pop();
for(int i=;i<=n;i++){
dfn[i]=;
bin[i]=;
head[i]=-;
expel[i]=true;
for(int j=;j<=n;j++) hate[i][j]=false;
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
bool oddc(int u,int cc){
col[u]=cc;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!book[v]) continue;
if(!col[v]&&oddc(v,-cc)) return true;
if(col[v]==cc) return true;
}
return false;
}
void pdc(int u,int fa){
dfn[u]=low[u]=++dn;
for(int i=head[u],v;~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
sta.push(Side(u,v));
pdc(v,u);
low[u]=min(low[u],low[v]);
if(low[v]>=dfn[u]){
bb[++bn].clear();
for(int i=;i<=n;i++){
col[i]=;
book[i]=false;
}
while(!sta.empty()){
int su=sta.top().u,sv=sta.top().v;
sta.pop();
if(su==u&&sv==v) break;
if(bin[su]!=bn){
bin[su]=bn;
book[su]=true;
bb[bn].push_back(su);
}
if(bin[sv]!=bn){
bin[sv]=bn;
book[sv]=true;
bb[bn].push_back(sv);
}
}
if(oddc(u,)){
int bbs=bb[bn].size();
if(bbs<) continue;
for(int i=;i<bbs;i++) expel[bb[bn][i]]=false;
}
}
}else if(v!=fa){
low[u]=min(low[u],dfn[v]);
if(dfn[u]>dfn[v]) sta.push(Side(u,v));
}
}
}
int main(){
int m,u,v;
while(~scanf("%d%d",&n,&m)&&(n||m)){
init();
while(m--){
scanf("%d%d",&u,&v);
hate[u][v]=hate[v][u]=true;
}
for(int i=;i<=n;i++)
for(int j=i+;j<=n;j++) if(!hate[i][j]){
add(i,j);
add(j,i);
}
for(int i=;i<=n;i++) if(!dfn[i]) pdc(i,i);
int ans=;
for(int i=;i<=n;i++) if(expel[i]) ans++;
printf("%d\n",ans);
}
return ;
}

我太难了

然后是一题很恐怖的OI题,这题已经没有OJ可以交了,我也只是把它给出的18组测试数据过了一遍,所以就当增加见识了。

[POI1999]仓库管理员

问题描述

码头仓库是一块N×M个格子的矩形,有的格子是空闲的——没有任何东西,有的格子上已经堆放了沉重的货物——太重了而不再可能被移动。

现在,仓库管理员有一项任务,要将一个小箱子推到指定的格子上去。管理员可以在仓库中移动,但不得跨过沉重的不可移动的货物和箱子。当管理 员站在与箱子相邻的格子上时,他可以做一次推动,把箱子推到另一个相邻的格子。考虑到箱子很重,仓库管理员为了节省体力,想尽量减少推箱子的次数。你能帮 帮他么?

输入文件

输入文件第一行有两个数N,M(1<=N,M<=100),表示仓库是N×M的矩形。以下有N行,每行有M个字符,表示一个格子的状态。

  • S 表示该格子上放了不可移动的沉重货物。
  • w 表示该格子上没有任何东西
  • M 表示仓库管理员初始的位置
  • P 表示箱子的初始位置
  • K 表示箱子的目标位置

输出文件

输出文件只有一行,一个数,表示仓库管理员最少要推多少次箱子。如果仓库管理员不可能将箱子推到目标位置,那么请输出NIE,表示无解。

样例输入

10 12
SSSSSSSSSSSS
SwwwwwwwSSSS
SwSSSSwwSSSS
SwSSSSwwSKSS
SwSSSSwwSwSS
SwwwwwPwwwww
SSSSSSSwSwSw
SSSSSSMwSwww
SSSSSSSSSSSS
SSSSSSSSSSSS

样例输出

7
首先一看,正常思路展开是双dfs,dp[i][j][k][l],就箱子的位置人的位置时的最少推动次数,但因为是推动次数不是步数,所以人的位置可以看成方向,dp[i][j][k]代表箱子在i,j位置,人在箱子k方向的最少推动次数,
然后的话就每次是bfs箱子移动的位置,同时改变人的方向,并然后二层bfs判断人能不能走到那个位置。但是数据是100*100的图,很明显这样做的话,会超时,所以就在于怎么把第二层bfs优化。
我们需要的就是知道人能不能从一个位置走到另一个位置,那我们把每个点和周围能走的点连边的话,如果是这两个点在同一个连通块的话,然后如果箱子不在割点位置,那么人肯定可以在两个位置间走来走去,那如果箱子不在割点位置呢,
很明显,这时候就是看那两个位置是不是在同一个连通块,而割点可以属于多个点双连通,这时候可能是其中一个位置是割点,所以我们还得记录一下相应点双连通那个割点。然后第二层bfs就成了O(1)判断 
然后我这里就放5组样例,要全部样例的,可以去那个OJ上注册一下账号,不过这题已经不判了,交了也没有。
 #include<cstdio>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
const int N=,NN=N*N,M=NN*;
const int dir[][]={{,},{,},{,-},{-,}};
struct Side{
int u,v,ne;
Side(){}
Side(int u,int v):u(u),v(v){}
}S[M];
struct Node{
int x,y,d,ac;
Node(){}
Node(int x,int y,int d,int ac):x(x),y(y),d(d),ac(ac){}
};
stack<Side> sta;
char ss[N][N];
bool isc[NN],vis[N][N];
int n,m,sn,dn,bn,head[NN],dfn[NN],low[NN],bin[NN],bf[NN];
int mx,my,px,py,kx,ky,dp[N][N][],com[N][N][][];
void init(){
sn=dn=bn=;
while(!sta.empty()) sta.pop();
for(int i=;i<=n;i++)
for(int j=;j<=m;j++){
isc[i*m+j]=false;
dfn[i*m+j]=;
head[i*m+j]=-;
vis[i][j]=false;
for(int k=;k<;k++){
dp[i][j][k]=-;
for(int l=;l<;l++) com[i][j][k][l]=-;
}
}
}
void add(int u,int v){
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
bool check(int x,int y){
return x>=&&x<n&&y>=&&y<m&&ss[x][y]!='S';
}
void pdc(int u,int fa){
dfn[u]=low[u]=++dn;
int v,son=;
for(int i=head[u];~i;i=S[i].ne){
v=S[i].v;
if(!dfn[v]){
if(u==fa) son++;
sta.push(Side(u,v));
pdc(v,u);
low[u]=min(low[u],low[v]);
if(low[v]>=dfn[u]){
if(u!=fa) isc[u]=true;
bf[++bn]=u;
while(!sta.empty()){
int su=sta.top().u,sv=sta.top().v;
sta.pop();
if(su==u&&sv==v) break;
if(bin[su]!=bn) bin[su]=bn;
if(bin[sv]!=bn) bin[sv]=bn;
}
}
}else if(v!=fa){
low[u]=min(low[u],dfn[v]);
if(dfn[u]>dfn[v]) sta.push(Side(u,v));
}
}
if(u==fa&&son>=) isc[u]=true;
}
void bfs1(){
queue<Node> q;
vis[mx][my]=true;
q.push(Node(mx,my,,));
int qx,qy,dx,dy;
while(!q.empty()){
qx=q.front().x;
qy=q.front().y;
q.pop();
for(int i=;i<;i++){
dx=qx+dir[i][];
dy=qy+dir[i][];
if(check(dx,dy)&&!vis[dx][dy]&&ss[dx][dy]!='P'){
vis[dx][dy]=true;
q.push(Node(dx,dy,,));
}
}
}
}
bool judge(int x,int y,int d1,int d2){
if(!isc[x*m+y]) return ;
if(com[x][y][d1][d2]!=-) return com[x][y][d1][d2];
int u=(x+dir[d1][])*m+(y+dir[d1][]);
int v=(x+dir[d2][])*m+(y+dir[d2][]);
return com[x][y][d1][d2]=(bin[u]==bin[v]||bf[bin[u]]==v||bf[bin[v]]==u);
}
void bfs2(){
queue<Node> q;
int qx,qy,dx,dy,qd,qac,ans=-;
for(int i=;i<;i++){
dx=px+dir[i][];
dy=py+dir[i][];
if(check(dx,dy)&&vis[dx][dy]){
dp[px][py][i]=;
q.push(Node(px,py,i,));
}
}
while(!q.empty()){
qx=q.front().x;
qy=q.front().y;
qd=q.front().d;
qac=q.front().ac;
q.pop();
if(qx==kx&&qy==ky){
ans=qac;
break;
}
dx=qx-dir[qd][],dy=qy-dir[qd][];//箱子走到下一个位置
if(check(dx,dy)&&dp[dx][dy][qd]==-){
dp[dx][dy][qd]=qac+;
q.push(Node(dx,dy,qd,qac+));
}
for(int i=;i<;i++){//改变人在箱子的方向
if(dp[qx][qy][i]!=-) continue;
dx=qx+dir[i][];
dy=qy+dir[i][];
if(check(dx,dy)&&judge(qx,qy,qd,i)){
dp[qx][qy][i]=qac;
q.push(Node(qx,qy,i,qac));
}
}
}
if(ans==-) printf("NIE\n");
else printf("%d\n",ans);
}
int main(){
while(~scanf("%d%d",&n,&m)){
init();
for(int i=;i<n;i++){
scanf("%s",ss[i]);
for(int j=;j<m;j++){
if(ss[i][j]=='M') mx=i,my=j;
else if(ss[i][j]=='P') px=i,py=j;
else if(ss[i][j]=='K') kx=i,ky=j;
else if(ss[i][j]=='S') continue;
for(int k=;k<;k++){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wwwwwwwwwwwwwwwwwSwSS
wwSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSwSwSS
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwSS
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSwwSS
输入5:

样例

对于边双连通分支,求法更为简单。只需在求出所有的桥以后,把桥边删除,原图变成了多个连通块,则每个连通块就是一个边双连通分支。桥不属于任何一个边双连通分支,其余的边和每个顶点都属于且只属于一个边双连通分支。

所以我们只要连把桥找出来,然后再dfs时跳过桥类似染色一样就可以得出边双连通了。

然后一个有桥的连通图,如何把它通过加边变成边双连通图

统计出树中度为1的节点的个数,即为叶节点的个数,记为leaf。则至少在树上添加(leaf+1)/2条边,就能使树达到边二连通,所以至少添加的边数就是(leaf+1)/2。具体方法为,首先把两个最近公共祖先最远的两个叶节点之间连接一条边,这样可以把这两个点到祖先的路径上所有点收缩到一起,因为一个形成的环一定是双连通的。然后再找两个最近公共祖先最远的两个叶节点,这样一对一对找完,恰好是(leaf+1)/2次,把所有点收缩到了一起。

Redundant PathsPOJ - 3177

题意:问需要新建多少条路,然后两点两两连通。

就照着上面的步骤实现就行。

 //统计出树中度为1的节点的个数,即为叶节点的个数,记为leaf。
//则至少在树上添加(leaf+1)/2条边,就能使树达到边二连通,
//所以至少添加的边数就是(leaf+1)/2。具体方法为,首先把两个最
//近公共祖先最远的两个叶节点之间连接一条边,这样可以把这两个
//点到祖先的路径上所有点收缩到一起,因为一个形成的环一定是双连
//通的。然后再找两个最近公共祖先最远的两个叶节点,
//这样一对一对找完,恰好是(leaf+1)/2次,把所有点收缩到了一起。
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=5e3+,M=1e4+;
struct Side{
int v,ne,id;
}S[M<<];
bool isq[M],vis[N];
int n,m,sn,dn,bn,head[N],dfn[N],low[N],fp[N],bin[N],du[N];
void init(){
sn=dn=bn=;
for(int i=;i<=n;i++){
vis[i]=false;
dfn[i]=bin[i]=;
fp[i]=head[i]=-;
}
for(int i=;i<=m;i++) isq[i]=false;
}
void add(int u,int v,int id){
S[sn].id=id;
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void findq(int u){
dfn[u]=low[u]=++dn;
int v,id;
for(int i=head[u];~i;i=S[i].ne){
v=S[i].v;id=S[i].id;
if(!dfn[v]){
fp[v]=id;
findq(v);
low[u]=min(low[u],low[v]);
}if(id!=fp[u]) low[u]=min(low[u],dfn[v]);
}
if(fp[u]!=-&dfn[u]==low[u]) isq[fp[u]]=true;
}
void dfs(int u){
bin[u]=bn;
vis[u]=true;
for(int i=head[u];~i;i=S[i].ne){
if(isq[S[i].id]) continue;
if(!vis[S[i].v]) dfs(S[i].v);
}
}
int main(){
int u,v;
while(~scanf("%d%d",&n,&m)){
init();
for(int i=;i<m;i++){
scanf("%d%d",&u,&v);
add(u,v,i);
add(v,u,i);
}
for(int i=;i<=n;i++) if(!dfn[i]) findq(i);
for(int i=;i<=n;i++) if(!vis[i]) bn++,dfs(i);
for(int i=;i<=bn;i++) du[i]=;
int bi,bj,ans=;
for(int i=;i<m;i++)
for(int j=head[i];~j;j=S[j].ne){
bi=bin[i],bj=bin[S[j].v];
if(bi!=bj) du[bi]++;
}
for(int i=;i<=bn;i++) if(du[i]==) ans++;
printf("%d\n",(ans+)/);
}
return ;
}

板子套一套

还有一题一样的题,数据范围不同而已,可以练一练手。

Road ConstructionPOJ - 3352

 #include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N=1e3+,M=2e3+;
struct Side{
int v,ne,id;
Side(){}
Side(int v,int ne):v(v),ne(ne){}
}S[M<<];
bool isq[M],vis[N];
int n,m,sn,dn,bn,head[N],dfn[N],low[N],fp[N],bin[N],du[N];
vector<Side> qiao;
void init(){
sn=dn=bn=;
qiao.clear();
for(int i=;i<=n;i++){
vis[i]=false;
dfn[i]=bin[i]=;
fp[i]=head[i]=-;
}
for(int i=;i<=m;i++) isq[i]=false;
}
void add(int u,int v,int id){
S[sn].id=id;
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void findq(int u,int fa){
dfn[u]=low[u]=++dn;
int v,id;
for(int i=head[u];~i;i=S[i].ne){
v=S[i].v;id=S[i].id;
if(!dfn[v]){
fp[v]=id;
findq(v,u);
low[u]=min(low[u],low[v]);
}if(id!=fp[u]) low[u]=min(low[u],dfn[v]);
}
if(fp[u]!=-&dfn[u]==low[u]){
isq[fp[u]]=true;
qiao.push_back(Side(fa,u));
}
}
void dfs(int u){
bin[u]=bn;
vis[u]=true;
for(int i=head[u];~i;i=S[i].ne){
if(isq[S[i].id]) continue;
if(!vis[S[i].v]) dfs(S[i].v);
}
}
int main(){
int u,v;
while(~scanf("%d%d",&n,&m)){
init();
for(int i=;i<m;i++){
scanf("%d%d",&u,&v);
add(u,v,i);
add(v,u,i);
}
for(int i=;i<=n;i++) if(!dfn[i]) findq(i,-);
for(int i=;i<=n;i++) if(!vis[i]) bn++,dfs(i);
for(int i=;i<=bn;i++) du[i]=;
int bu,bv,ans=,qis=qiao.size();
printf("%d\n",qis);
for(int i=;i<qis;i++){
bu=bin[qiao[i].v];
bv=bin[qiao[i].ne];
du[bu]++;
du[bv]++;
}
for(int i=;i<=bn;i++) if(du[i]==) ans++;
printf("%d\n",(ans+)/);
}
return ;
}

汤没换,药也没换

NetworkPOJ - 3694

题意:问每次在两点间加一条边,还剩下多少个桥。

我们先求出边双连通,然后缩点把桥加回来的话,就是一棵树了,然后每次在两个点之间加边的话,就是它们到它们最近公共祖先的边,原先是桥的边,现在就不是了。

这个处理可以用树链剖分,很明显的路径修改,不过看了网上还有个就是并查集直接把路径上的点合并的方法。

 #include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N=1e5+,M=2e5+;
struct Side{
int v,ne,id;
Side(){}
Side(int v,int ne):v(v),ne(ne){}
}S[M<<];
bool isq[M],vis[N];
int n,m,sn,bn,dn,head[N],dfn[N],low[N];
int fp[N],bin[N],up[N],dep[N],bf[N];
vector<int> vv[N];
vector<Side> qiao;
void init(){
sn=bn=dn=;
qiao.clear();
for(int i=;i<=n;i++){
vis[i]=false;
dfn[i]=bin[i]=;
fp[i]=head[i]=-;
}
for(int i=;i<=m;i++) isq[i]=false;
}
void add(int u,int v,int id){
S[sn].id=id;
S[sn].v=v;
S[sn].ne=head[u];
head[u]=sn++;
}
void findq(int u,int fa){
dfn[u]=low[u]=++dn;
int v,id;
for(int i=head[u];~i;i=S[i].ne){
v=S[i].v;id=S[i].id;
if(!dfn[v]){
fp[v]=id;
findq(v,u);
low[u]=min(low[u],low[v]);
}else if(id!=fp[u]) low[u]=min(low[u],dfn[v]);
}
if(fp[u]!=-&&dfn[u]==low[u]){
isq[fp[u]]=true;
qiao.push_back(Side(fa,u));
}
}
void dfs1(int u){
vis[u]=true;
bin[u]=bn;
for(int i=head[u];~i;i=S[i].ne){
if(isq[S[i].id]) continue;
if(!vis[S[i].v]) dfs1(S[i].v);
}
}
void dfs2(int u){
int v,vvs=vv[u].size();
for(int i=;i<vvs;i++){
v=vv[u][i];
dep[v]=dep[u]+;
up[v]=u;
dfs2(v);
}
}
int find(int x){
return bf[x]==x ? x : bf[x]=find(bf[x]);
}
void bing(int x,int y){
int fx=find(x),fy=find(y);
if(fx!=fy) bf[fx]=fy;
}
int lca(int u,int v){
int ans=;
while(dep[u]>dep[v]){
bing(u,up[u]);
ans++;
u=find(up[u]);
}
while(dep[v]>dep[u]){
bing(v,up[v]);
ans++;
v=find(up[v]);
}
while(u!=v){
bing(u,up[u]);
bing(v,up[v]);
ans+=;
u=find(up[u]);
v=find(up[v]);
}
return ans;
}
int main(){
int u,v,q,t=;
while(~scanf("%d%d",&n,&m)&&(n||m)){
init();
for(int i=;i<m;i++){
scanf("%d%d",&u,&v);
add(u,v,i);
add(v,u,i);
}
for(int i=;i<=n;i++) if(!dfn[i]) findq(i,-);
for(int i=;i<=n;i++) if(!vis[i]) bn++,dfs1(i);
for(int i=;i<=bn;i++){
bf[i]=i;
vv[i].clear();
}
int bu,bv,qis=qiao.size();
for(int i=;i<qis;i++){
bu=bin[qiao[i].v];
bv=bin[qiao[i].ne];
vv[bu].push_back(bv);
}
dep[]=;
dfs2();
scanf("%d",&q);
printf("Case %d:\n",t++);
while(q--){
scanf("%d%d",&u,&v);
bu=find(bin[u]);
bv=find(bin[v]);
qis-=lca(bu,bv);
printf("%d\n",qis);
}
}
return ;
}

上树是不可能上树的了

到此,大概就梳理到这些了,接下来主要心思转向数论。还是感觉自己有些松散,不然按照自己打算的计划,一两周前就该把这个完成了,唉,继续前进把,

最新文章

  1. Unity 序列化
  2. 第二天----列表、元组、字符串、算数运算、字典、while
  3. Java开发环境的搭建以及使用eclipse从头一步步创建java项目
  4. php生成html文件的多种方法介绍
  5. 拦截JQuery的ajax
  6. 【转】EL表达式 (详解)
  7. Xcode环境下OpenGL C++ GLFW开发环境搭建
  8. SqlServer2005基于已有表创建分区
  9. PHP页面跳转几种实现技巧
  10. wscript:329: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are
  11. Java设计模式之装饰者模式
  12. 关于WIN10开机无法输入密码的问题
  13. 20155206 2016-2017-2 《Java程序设计》第5周学习总结
  14. Android拦截并获取WebView内部POST请求参数
  15. 商誉专题RN及H5项目总结
  16. Python爬虫之三
  17. 挑战常规--搭建gradle、maven私人仓库很简单
  18. c++中vector类的用法
  19. mvn本地库导入jar包
  20. day20 project+查看新闻列表 + 点赞 + 图片验证码 + 评论和多级评论 + 后台管理 + webSocket + kindEditor

热门文章

  1. 第7章:LeetCode--算法:递归问题
  2. 牛客 197C 期望操作数
  3. skywalking-agent 与docker组合使用
  4. 利用Mathpix Snipping Tool轻松在markdown/LaTeX中输入电子书和论文的数学公式
  5. java中long类型转换为int类型
  6. 学习前端 第一天之html标签补充
  7. requests模块发送数据
  8. oracle解锁oracle默认用户scott
  9. Python下载安装及验证
  10. Systemd: Service File Examples