摘要: ###2. 01背包问题 链接:https://www.acwing.com/problem/content/2/ // 二维解法 #include <iostream> using namespace std; const int N = 1010; int n, m, v[N], w[N], f 阅读全文
posted @ 2020-10-08 22:21 景云ⁿ 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/number-of-islands/ // flood fill class Solution { public: vector<vector<char>> g; int dx[4] = {-1, 0, 1, 0}, dy[4] 阅读全文
posted @ 2020-10-05 21:03 景云ⁿ 阅读(77) 评论(0) 推荐(0) 编辑
摘要: ###170. 加成序列 链接:https://www.acwing.com/problem/content/172/ #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int 阅读全文
posted @ 2020-10-04 19:17 景云ⁿ 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 优化搜索顺序 大部分情况下,我们应该优先搜索分支较少的节点; 排除等效冗余 可行性剪枝 最优性剪枝 记忆化搜索(DP) ###165. 小猫爬山 链接:https://www.acwing.com/problem/content/167/ #include <iostream> #include < 阅读全文
posted @ 2020-10-03 21:01 景云ⁿ 阅读(118) 评论(0) 推荐(0) 编辑
摘要: ###1112. 迷宫 链接:https://www.acwing.com/problem/content/1114/ #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int 阅读全文
posted @ 2020-09-29 10:53 景云ⁿ 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 190. 字串变换 链接:https://www.acwing.com/problem/content/192/ #include <cstring> #include <iostream> #include <algorithm> #include <unordered_map> #include 阅读全文
posted @ 2020-09-26 22:21 景云ⁿ 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 173. 矩阵距离 链接:https://www.acwing.com/problem/content/175/ #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int N 阅读全文
posted @ 2020-09-26 22:20 景云ⁿ 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Flood Fill 可以在线性时间复杂度内找到某个点所在的连通块 1097.池塘计数 链接:https://www.acwing.com/problem/content/1099/ #include <iostream> #include <algorithm> #include <cstring 阅读全文
posted @ 2020-09-22 19:46 景云ⁿ 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 最短路: 1.单源最短路 所有边权都是正数:朴素Dijkstra算法(O(\(n^2\)))、堆优化Dijkstra算法(O(\(mlongn\))) 存在负权边:Bellman-Ford算法(O(\(nm\)))、SPFA算法(一般O(\(m\)),最坏O(\(nm\))) 2.多源汇最短路:Fl 阅读全文
posted @ 2020-09-20 16:45 景云ⁿ 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 842.排列数字 链接:https://www.acwing.com/problem/content/844/ #include <iostream> using namespace std; const int N = 10; int n; int path[N]; bool st[N]; voi 阅读全文
posted @ 2020-09-18 10:20 景云ⁿ 阅读(177) 评论(0) 推荐(0) 编辑