过了样例就能AC
注意一点 0条边特意判断下。是否无法构成生成树也要判断
#include
#include
#include
using namespace std;
#define maxn 110
int parent[maxn];
int N,M;
struct edge
{
int u,v,w;
}edges[maxn*maxn];
int cmp(void const *a,vo...
分类:
其他好文 时间:
2014-08-16 21:08:41
阅读次数:
190
Problem H
Halum
Time Limit : 3 seconds
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some vertex i to vertex j has...
分类:
其他好文 时间:
2014-08-08 21:24:11
阅读次数:
570
题意:
要求在一个特殊的图上找最大匹配,该图特点是:无向图,每个节点度数为3,是一个边双连通分量(the graph is 2-edge-connected (that is, at least 2 edges need to be removed in order to make the graph disconnected) 这一点是这样理解的把。。)
思路:
一般想法就直接建图求最大匹...
分类:
其他好文 时间:
2014-07-23 13:22:07
阅读次数:
207
本节介绍在 D3 中如何制作力学图,我们用 Layout 将普通数据转换成作图需要的数据。...
分类:
Web程序 时间:
2014-07-23 13:03:16
阅读次数:
309
#include#include#include#includeusing namespace std;#define N 5505#define M 55000//注意边和点集的数组大小struct edge{ int to,value,next;}edges[M];int heads[N]...
分类:
其他好文 时间:
2014-07-22 00:20:35
阅读次数:
213
Description
Problem H
Halum
Time Limit : 3 seconds
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some ...
分类:
其他好文 时间:
2014-07-22 00:11:35
阅读次数:
225
Description
Problem H
Halum
Time Limit : 3 seconds
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some ...
分类:
其他好文 时间:
2014-07-22 00:08:34
阅读次数:
307
Rectangle and Circle
Problem Description
Given a rectangle and a circle in the coordinate system(two edges of the rectangle are parallel with the X-axis, and the other two are parallel with the Y...
分类:
其他好文 时间:
2014-07-02 07:29:06
阅读次数:
268
寻找图中最小连通的路径,图如下:
算法步骤:
1. Sort all the edges in non-decreasing order of their weight.
2. Pick the smallest edge. Check if it forms a cycle with the spanning tree
formed so far. If cycle is n...
分类:
其他好文 时间:
2014-05-25 07:35:59
阅读次数:
301
Problem Description
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the follow...
分类:
其他好文 时间:
2014-05-21 10:55:57
阅读次数:
325