多学习。

上一页 1 2 3 4 5 6 7 8 9 ··· 16 下一页
摘要: AcWing850.Dijkstra求最短路 II 题解 #include <iostream> #include <cstring> #include <queue> #include <vector> using namespace std; const int N = 1e6 + 10; ty 阅读全文
posted @ 2022-05-25 20:40 czyaaa 阅读(47) 评论(0) 推荐(0)
摘要: 详解 规定n为点数, m为边数 稀疏图用堆优化Dijkstra, 稠密图用朴素Dijkstra 题目 朴素Dijkstra:AcWing849.Dijkstra求最短路 I 堆优化Dijkstra:AcWing850.Dijkstra求最短路 II bellman-ford:AcWing853.有边 阅读全文
posted @ 2022-05-24 21:55 czyaaa 阅读(14) 评论(0) 推荐(0)
摘要: AcWing849.Dijkstra求最短路 I 题解 注意:本题存在重边,故g[x][y] = min(g[x][y], z); #include <iostream> #include <cstdio> #include <cstring> using namespace std; const 阅读全文
posted @ 2022-05-24 21:54 czyaaa 阅读(31) 评论(0) 推荐(0)
摘要: 依赖 <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.2</version> </dependency> 配置 单纯使用mybatis无spr 阅读全文
posted @ 2022-05-24 20:36 czyaaa 阅读(104) 评论(0) 推荐(0)
摘要: AcWing848.有向图的拓扑序列 题解 额外知识:有向无环图必然有拓扑序列 将入度为0的点放入队列,再逐一拿出,那些以此点为入度的点减1,若有新的入度为0则放入队列。 #include <iostream> #include <cstdio> #include <cstring> using n 阅读全文
posted @ 2022-05-24 10:04 czyaaa 阅读(49) 评论(0) 推荐(0)
摘要: AcWing845.八数码 题解 还是一道bfs标准题,每次存入4个方向的状态,直到找到最终状态 #include <iostream> #include <cstdio> #include <unordered_map> #include <queue> using namespace std; 阅读全文
posted @ 2022-05-24 09:27 czyaaa 阅读(27) 评论(0) 推荐(0)
摘要: AcWing847.图中点的层次 题解 #include <iostream> #include <cstring> #include <queue> #include <cstdio> using namespace std; const int N = 1e5 + 10; int n, m; q 阅读全文
posted @ 2022-05-23 22:47 czyaaa 阅读(36) 评论(0) 推荐(0)
摘要: AcWing846.树的重心 题解 树的深度优先遍历:可以算出各子树的结点数 #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int N = 1e5 + 10; int ans = 阅读全文
posted @ 2022-05-23 22:11 czyaaa 阅读(38) 评论(0) 推荐(0)
摘要: AcWing844.走迷宫 题解 stl #include <iostream> #include <cstring> #include <queue> using namespace std; typedef pair<int,int> PII; const int N = 110; queue< 阅读全文
posted @ 2022-05-23 15:50 czyaaa 阅读(32) 评论(0) 推荐(0)
摘要: AcWing843.n-皇后问题 题解 解法一:对每一行进行遍历,因为皇后不在同一列,故每一行取不同列(列行转换同理) #include <iostream> #include <cstdio> //对每一行进行遍历,由于皇后不能在同一列,故每一行的摆放列都不同 using namespace st 阅读全文
posted @ 2022-05-22 17:14 czyaaa 阅读(51) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 16 下一页