会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
N1nEmAn
首页
新随笔
管理
上一页
1
2
3
4
5
6
···
8
下一页
2025年8月22日
染色判断二分图
摘要: rt #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> using namespace std; vector<vector<int>>ev; vector<i
阅读全文
posted @ 2025-08-22 17:57 .N1nEmAn
阅读(15)
评论(0)
推荐(0)
2025年8月21日
Kruskal算法求最小生成树
摘要: rt 所有的边权录入,然后根据权排序,从小到大构成最小生成树。使用并查集,确保在一个联通的不要再更新。 #include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace std;
阅读全文
posted @ 2025-08-21 11:39 .N1nEmAn
阅读(13)
评论(0)
推荐(0)
2025年8月18日
Prim
摘要: 最小生成树 #include <iostream> #include <cstring> #include <algorithm> #include <queue> #include <vector> using namespace std; typedef pair<int, int> PII;
阅读全文
posted @ 2025-08-18 23:29 .N1nEmAn
阅读(14)
评论(0)
推荐(0)
弗洛伊德
摘要: 求最短路径 注意一下读取边的时候,最开始都设置为最大,然后读取的时候必须比现在的小才读取,用min就行。注意初始化自己到自己是0。 #include <iostream> #include <cstring> #include <algorithm> #include <vector> using
阅读全文
posted @ 2025-08-18 17:22 .N1nEmAn
阅读(8)
评论(0)
推荐(0)
spfa
摘要: 最短路径 把处理的加入队列,下次也是从队列取出来处理,直到队列空了。感觉跟我第一次错迪杰斯特拉一样,但是这个好理解也简单。 漏了两个处理:1是记录已经在队列的就不要入了。2是记录进入队列次数,超过n就是负数。 #include <iostream> #include <cstring> #inclu
阅读全文
posted @ 2025-08-18 11:50 .N1nEmAn
阅读(10)
评论(0)
推荐(0)
2025年8月17日
BF
摘要: 每次遍历所有边权跟上次的比dist,prev+c更新。 n-1之后还可更新有负权回路。 注意prev[a]不可是INF 次数限制的最短路径 #include <iostream> #include <cstring> #include <algorithm> #include <vector> us
阅读全文
posted @ 2025-08-17 20:51 .N1nEmAn
阅读(10)
评论(0)
推荐(0)
2025年8月10日
迪杰斯特拉
摘要: 1 #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <climits> using namespace std; //思路就是每次构成一个最短的,下次从最短的下一个开始不断构
阅读全文
posted @ 2025-08-10 17:08 .N1nEmAn
阅读(39)
评论(0)
推荐(0)
2025年8月4日
DFS/BFS
摘要: 关于DFS其实本质就是,当path达到对应数量就输出!如果没有达到,那么看看哪些还可以选择,如果可以选择就插入path,标记不可选,然后递归,然后标记可用,然后弹出,就是这么一个套路。 DFS:达则可,否则遍历入标递标出。 BFS:队列不空出遍入。 排列数字 使用回溯法生成所有可能的排列 每次选择一
阅读全文
posted @ 2025-08-04 10:02 .N1nEmAn
阅读(7)
评论(0)
推荐(0)
2025年8月2日
散列表
摘要: 哈希表 我用的拉链法。 #include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace std; int N = 100003; vector<int> H[100003];
阅读全文
posted @ 2025-08-02 20:54 .N1nEmAn
阅读(11)
评论(0)
推荐(0)
堆
摘要: 堆排序 推荐:https://www.acwing.com/solution/content/120483/ #include <iostream> #include <cstring> #include <algorithm> using namespace std; int A[100100],
阅读全文
posted @ 2025-08-02 19:05 .N1nEmAn
阅读(8)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
···
8
下一页
公告