上一页 1 ··· 5 6 7 8 9 10 11 下一页
摘要: 普通 #include<iostream> using namespace std; #include<algorithm> #include<cstring> const int N = 5010; int n, f[N]; int a[N]; int main() { cin >> n; for 阅读全文
posted @ 2024-08-07 15:18 某朝 阅读(12) 评论(0) 推荐(0)
摘要: 题目acwing #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 100010; int n, m; int h[N], e[N], ne[N], idx; int 阅读全文
posted @ 2024-08-04 18:03 某朝 阅读(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)
摘要: 树和图的框架 #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)
摘要: 董晓的宽搜模板 #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)
摘要: 大佬的解析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)
摘要: 简单用法 阅读全文
posted @ 2024-07-28 15:28 某朝 阅读(9) 评论(0) 推荐(0)
摘要: 拉链法 哈希函数:f(x) = ( x % N + N ) % N k就是下标, h[k]=x 哈希表的头节点(head指针)是idx,就是第几个插入的序号 idx没什么用,用头插法插入元素,插入和寻找都是h[k]在起作用 idx会变,当插入第二个下标为k的元素时,idx就会变成新的。 #inclu 阅读全文
posted @ 2024-07-27 21:36 某朝 阅读(20) 评论(0) 推荐(0)
摘要: 插入一个数 heap[++size]=x; up(size); 求集合当中的最下值 heap[1]; 删除最小值 heap[1]=heap[size]; size--; down(1); 删除任意一个元素 heap[k]=heap[size]; size--; up(k); down(k); 修改任 阅读全文
posted @ 2024-07-27 17:46 某朝 阅读(9) 评论(0) 推荐(0)
摘要: // 关闭输入输出缓存,使效率提升 ios::sync_with_stdio(false); // 解除cin和cout的默认绑定,来降低IO的负担使效率提升 cin.tie(NULL); cout.tie(NULL); 阅读全文
posted @ 2024-07-27 16:21 某朝 阅读(35) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 下一页