![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
遍历图
wangfy_
这个作者很懒,什么都没留下…
展开
-
1034 Head of a Gang (30)
Head of a Gang.One way that the police finds the head of a gang is to check people's phone calls. 'If there is a phone call between A and B, we say that A and B is related(相关). The weight of a rel...原创 2018-02-21 13:12:45 · 156 阅读 · 0 评论 -
1076 Forwards on Weibo (30)
Forwards on Weibo.Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with follow...原创 2018-02-21 13:13:23 · 180 阅读 · 0 评论 -
遍历图
// DFS遍历图 ---------------------------------------------------------const MAXV = 1000;const INF = 1000000000;// 邻接矩阵版int n, G[MAXV][MAXV];bool vis[MAXV];void DFS(int u, int depth) { vis[u] = tru...原创 2018-04-21 01:21:14 · 153 阅读 · 0 评论 -
1013 Battle Over Cities (25)
//code1 DFS数出连通块数 -------------------------------#include <cstdio>#include <vector>#include <cstring>using namespace std;const int MAXN = 1010;vector<int> G[MAXN];bool v...原创 2018-06-25 00:26:36 · 138 阅读 · 0 评论 -
存储图
// 存储图 ---------------------------------------------------------// 若仅有点权,需要结构体Node记录一个节点的编号和点权,最好用邻接表。// 若仅有边权,最好直接用邻接矩阵。// 若有点权和边权,用邻接矩阵记录结构体Node节点吧。// 邻接表存储有点权的图struct Node { int v; int w; ...原创 2018-04-21 01:18:27 · 160 阅读 · 0 评论 -
1021 Deepest Root (25)
(待)原创 2018-06-27 22:34:45 · 430 阅读 · 1 评论