![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论
玛珈山大萌新
破山中贼易,破心中贼难。不破不立,破而后立,立而为人。
展开
-
Counting Stars HDU - 6184[三元环计数]
题目: 给你一个图,求有多少不同的由两个三元环拼起来的图形。 分析: 三元环计数题,考虑每个边的贡献,设num = 每个边参与构成的图形数,则贡献为num * (num - 1) / 2,注意用链式前向星来存边的贡献。 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll;//三年竞赛一场空,不开long long见祖宗 //typedef __int128 lll; #define print(i) co原创 2020-10-18 01:00:03 · 84 阅读 · 0 评论 -
洛谷P1989 无向图三元环计数
分析: 洛谷题解 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll;//三年竞赛一场空,不开long long见祖宗 //typedef __int128 lll; #define print(i) cout << "debug: " << i << endl #define close() ios::sync_with_stdio(0), cin.tie(0), c原创 2020-10-17 22:51:53 · 133 阅读 · 0 评论 -
二分图的完美匹配
题目: codevs 1222 信与信封问题 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题解 查看运行结果 题目描述Description John先生晚上写了n封信,并相应地写了n个信封将信装好,准备寄出。但是,第二天John的儿子SmallJohn将这n封信都拿出了信封。不幸的是,SmallJohn无法将拿出的信...原创 2019-04-26 19:55:42 · 803 阅读 · 0 评论 -
二分图匹配
7-5Punching Power(20分) The park management finally decided to install some popular boxing machines at various strategic places in the park. In fact, to compensate for the previous lack of machines...原创 2019-04-23 21:04:56 · 252 阅读 · 0 评论 -
Sorting It All Out
总结 通过这道题,我对拓扑排序的多种情况有了更深一层的了解,一下是注意的几点: 1、正常的拓扑排序应该是遍历n次,每次找出一个最小元;如果在过程中出现 ①没有找到最小元——有环 ②找到多个极小元(多个入度为零的节点)——拓扑排序一定不唯一,而且也可能有环。 2、弄懂上述逻辑的代码实现——tp()。 题目: 用小于号"<"来定义两元素之间的关系,并于一个...原创 2019-07-15 21:20:09 · 690 阅读 · 0 评论