随笔分类 -  图论

摘要:直接用DFS进行搜索即可 class Solution { public: int numIslands(vector<vector<char>>& grid) { if(grid.empty()) { return 0; } int ans = 0; for(int i = 0; i < grid 阅读全文
posted @ 2020-04-20 15:54 LightAc 阅读(144) 评论(0) 推荐(0)
摘要:Matrix-Tree 定理又称基尔霍夫矩阵树定理,其用于解决:给定 n 个点 m 条边的无向图,求图的生成树个数的问题。 【基尔霍夫矩阵】1.基本定义1)无向图 G:给定 n 个点,m 条边的无向图,设点集为 V,边集为 E,则其记为 G(V,E)2)度数矩阵 D[G]:当 i≠j 时,D[i][ 阅读全文
posted @ 2020-04-20 15:20 LightAc 阅读(500) 评论(0) 推荐(0)
摘要:https://www.bilibili.com/video/BV1FK411j7JS 阅读全文
posted @ 2020-04-16 10:19 LightAc 阅读(146) 评论(0) 推荐(0)
摘要:1. Sample Input 9 5 2 1 5 2 1 5 2 1 4 1 2 3 4 0 Sample Output 6 5 #include <bits/stdc++.h> using namespace std; typedef long long ll; int a[100]; bool 阅读全文
posted @ 2020-03-12 23:06 LightAc 阅读(212) 评论(0) 推荐(0)
摘要:1. Sample Input 6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .# 阅读全文
posted @ 2020-03-12 08:19 LightAc 阅读(163) 评论(0) 推荐(0)
摘要:A.N皇后问题 阅读全文
posted @ 2019-03-18 23:08 LightAc 阅读(182) 评论(0) 推荐(0)
摘要:一、问题引入原题:杭电hdu1232畅通工程https://vjudge.net/problem/HDU-1232读不懂题请点击右上角关闭2.故事描述(来源于网络)并查集由一个整数型的数组和两个函数构成。数组pre[]记录了每个点的前导点是什么,函数find... 阅读全文
posted @ 2019-03-03 22:32 LightAc 阅读(199) 评论(0) 推荐(0)
摘要:(图论与数学结合)Monochromatic Triangles SCU 2090 Triangle:三角形; monochromatic:单色的;segments:部分;vertices:顶点题意:第一行输入的代表的是输入图形的测试个数n(1),之后会有... 阅读全文
posted @ 2019-02-25 21:51 LightAc 阅读(147) 评论(0) 推荐(0)

返回顶端