![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论
prometheus_97
这个作者很懒,什么都没留下…
展开
-
poj 1679(次小生成树)
http://poj.org/problem?id=1679 题意:给你一个图,求最小生成树是否唯一。 思路:求次小生成树,看它和最小生成树的权值是否相等。#include<iostream> #include<string.h> #include<stdio.h> #include<algorithm> #define INF 99999999 using namespace std; int原创 2017-10-13 21:08:59 · 164 阅读 · 0 评论 -
双联通分量 HDU4738
题意:给你一张图,求w最小的桥。 http://acm.hdu.edu.cn/showproblem.php?pid=4738注意:可能不是联通图(先用并查集判断联通),没有人的时候要输出1,没有桥输出-1。#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #define MAXN 100原创 2017-11-14 20:06:12 · 135 阅读 · 0 评论 -
poj 2762
http://poj.org/problem?id=2762 题意:给你n个房间,m条单向边,问你对于任意的x,y是否都有一条道路从x到y,或者从y到x。思路:先用tarjan缩点,再用拓扑排序,如果发现去掉一个点之后有新增两个入度为0的点,则不能。附上测试数据 4 4 1 2 2 3 3 4 2 4 Yes4 3 1 2 2 3 2 4 No#include <iostrea原创 2017-11-27 20:02:50 · 289 阅读 · 0 评论