08 2021 档案
摘要:题目链接 AcWing 3803. 数组去重 #include <iostream> #include <cstring> #include <algorithm> #include <stack> using namespace std; const int N = 60, M = 1010; i
阅读全文
摘要:基础课图论复习-最短路 朴素Dijkstra算法 (适合稠密图 用邻接矩阵存图) 时间复杂度 O(\(n^2 + m\)) n表示点数, m表示边数 AcWing 849. Dijkstra求最短路I int g[N][N]; // 存储每条边 int dist[N]; // 存储1号点到每个点的最
阅读全文
摘要:题目链接AcWing 1106. 山峰和山谷 经典Flood Fill 用bfs做 #include <iostream> #include <algorithm> #include <cstring> #define x first #define y second using namespace
阅读全文
摘要:题目链接 AcWing1098. 城堡问题 #include <iostream> #include <cstring> #include <algorithm> #define x first #define y second using namespace std; typedef pair<i
阅读全文
摘要:题目链接 AcWing1097. 池塘计数 经典FloodFill 用bfs做 #include <iostream> #include <algorithm> #include <cstring> #define x first #define y second using namespace s
阅读全文
摘要:#include <iostream> #include <algorithm> #include <cstring> using namespace std; const int N = 110; int n, m; int s[N], f[N]; int v[N][N], w[N][N]; in
阅读全文
摘要:题目链接 AcWing 5.多重背包问题II 二进制优化多重背包 二进制优化原理(不难证明) 对于一个整数S,不妨设 S = \((1101011)_{2}\) 为 7位2进制整数, 我们可以由{\({2^0,2^1,2^2,2^3,2^4,2^5,2^6,2^7}\)}(集合中的元素要么选,要么不
阅读全文
摘要:题目链接AcWing 4.多重背包问题 朴素版 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 110; int n, m; int f[N][N]; //f
阅读全文
摘要:题目链接 AcWing 3. 完全背包问题 朴素法 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 1010; int n, m; int v, w; int
阅读全文
摘要:题目链接 Acwing 2. 01背包 朴素版01背包 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 1010; int n, m; int v, w; i
阅读全文
浙公网安备 33010602011771号