合集-图论

摘要:树和图的框架 #include<iostream> #include<algorithm> using namespace std; const int N = 10010; int h[N], e[N], ne[N], idx; //a所对应的单链表中插入b a作为根 void add(int a 阅读全文
posted @ 2024-07-29 14:27 某朝 阅读(26) 评论(0) 推荐(0)
摘要:树的重心 原题 B站董晓讲解 任取一点u,若以u为重心,则分为两类:一类是u的子树,一类是u上面的部分 需要算出u的最大子树的节点树和u上面的部分的节点数,然后取两者的最大值。 add函数:a所对应的单链表中插入b a作为根 我的代码 #include<iostream> using namespa 阅读全文
posted @ 2024-07-31 20:02 某朝 阅读(29) 评论(0) 推荐(0)
摘要:大佬的解析DFS #include<iostream> using namespace std; const int N = 10; int n; int path[N]; bool st[N]; void dfs(int u) { if (u == n) { for (int i = 0; i < 阅读全文
posted @ 2024-07-28 21:06 某朝 阅读(30) 评论(0) 推荐(0)
摘要:董晓的宽搜模板 #include <iostream> #include <cstring> #include <algorithm> #include <queue> using namespace std; const int N = 100010; int n, m, a, b; vector 阅读全文
posted @ 2024-07-29 11:21 某朝 阅读(25) 评论(0) 推荐(0)
摘要:Description 数据结构与算法实验题 Sins of a Solar EmpireP6 ★实验任务 正如你所知道的s_sin是一个贪玩的不得了的小P孩QAQ,你也知道他最近很喜欢玩一个叫做太阳帝国的原罪的策略游戏去年 他已经和疯狂的AI交战了整整一年。而现在,战斗的序幕又要拉开了。 在某个星 阅读全文
posted @ 2024-11-28 21:47 某朝 阅读(43) 评论(0) 推荐(0)
摘要:https://wenku.csdn.net/answer/950d58e43a8340899c2ccf14ae4c494b Prime:添加点,基于邻接矩阵 // Luogu P3366 【模板】最小生成树 #include <iostream> #include <cstring> #inclu 阅读全文
posted @ 2024-12-17 11:37 某朝 阅读(126) 评论(0) 推荐(0)