codlz
codlz
全部文章
未归档
不抄模板能解题?(12)
后端开发实践(2)
题解(1)
归档
标签
去牛客网
登录
/
注册
这都不会?
全部文章
/ 未归档
(共51篇)
带权并查集 记录节点到根的距离
AcWing 240. 食物链 #include <bits/stdc++.h> using namespace std; const int N = 50005; int p[N], dis[N]; //dis为到根节点的距离 int find(int x) { ...
2021-05-06
0
442
二叉搜索树 遍历 镜像
PTA 7-28 搜索树判断 (25分) 对于二叉搜索树,我们规定任一结点的左子树仅包含严格小于该结点的键值,而其右子树包含大于或等于该结点的键值。如果我们交换每个节点的左子树和右子树,得到的树叫做镜像二叉搜索树。 现在我们给出一个整数键值序列,请编写程序判断该序列是否为某棵二叉搜索树或某镜像二叉搜...
2021-05-06
0
424
堆排序模板 输入一个长度为n的整数数列,从小到大输出前m小的数。
#include <bits/stdc++.h> using namespace std; const int N = 100005; int heap[N], siz; int n, m; void down(int i) { int t = i; //t记录i...
2021-05-06
0
552
有向图的拓扑排序 链式前向星
AcWing 848. 有向图的拓扑序列 #include <bits/stdc++.h> using namespace std; const int N = 100005; struct Node { int nxt, to; }nodes[N]; int...
2021-05-06
0
512
SPFA判断负环 朴素方法 用入队次数判断 一定超时
#include <bits/stdc++.h> using namespace std; const int N = 2005, M = 10005; int head[N], cnt; int n, m; int dis[N], backup[N]; int in[N]; //...
2021-05-06
0
395
SPFA 超级源点 判断负环
AcWing 852. spfa判断负环 #include <bits/stdc++.h> using namespace std; const int N = 2005, M = 10005; int head[N], cnt; int n, m; int dis[N], bac...
2021-05-06
0
383
prim 朴素 最小生成树
#include <bits/stdc++.h> using namespace std; const int N = 510; int grid[N][N]; int st[N]; int dis[N]; int n, m; int prim() { memset...
2021-05-06
0
399
区间和的个数 线段树查询修改 离散化
const int N = 40005; class SegmentTree { public: struct { int val; int l, r; }tree[N]; inline int ls(int roo...
2021-05-06
0
355
染色法判定二分图 模板题
#include <bits/stdc++.h> using namespace std; const int N = 100005; struct { int to; int nxt; }edges[N << 1]; int head[N], ...
2021-05-06
0
433
二分图的最大匹配 匈牙利算法 模板
#include <bits/stdc++.h> using namespace std; const int N = 505, M = 100005; int n1, n2, m; int head[N], cnt; struct { int to, nxt; ...
2021-05-06
0
384
首页
上一页
1
2
3
4
5
6
下一页
末页