![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
拓扑排序
银之夏雪
这个作者很懒,什么都没留下…
展开
-
HDU4324Triangle LOVE
这道题其实就是一道拓扑排序的模板题,只要有环就证明存在三角关系,代码如下#include <iostream> #include <string.h> #include <stdio.h> #include <queue> using namespace std; const int N=2005; bool vis[N]; int head[N],degree[N]; int q[N],cnt,n原创 2016-03-27 16:54:42 · 362 阅读 · 0 评论 -
poj1094Sorting It All Out(拓扑排序)
这题挺奇怪的,我之前还真么做过这样的拓扑排序,之前卡了一阵子,这个题目是判断到第几个成环,到第几个正好能唯一排序,另一种就是怎么也排不了序,就是每个数据跑一遍拓扑排序就行了#include <iostream> #include <queue> #include <string.h> #include <stdio.h> using namespace std; const int maxn=30;原创 2016-06-23 16:39:02 · 383 阅读 · 0 评论