![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
拓扑排序
wxfwxf328
这个作者很懒,什么都没留下…
展开
-
hdu 2647 Reward 拓扑排序
http://acm.hdu.edu.cn/showproblem.php?pid=2647 #include #include #include using namespace std; const int maxn=10000+5; paire[maxn];//first:入度 second:工资(最低为0) void toposort(vector v[],const int n) {原创 2012-01-21 01:38:59 · 772 阅读 · 0 评论 -
hdu 3343 Legal or Not 拓扑排序(容易题)
#include #include using namespace std; const int maxn=100+5; int e[maxn]; vectorv[maxn]; void toposort(vector v[],const int n) { int flag=1,cnt=0; while(flag) { flag=0; for原创 2012-01-21 23:12:36 · 869 阅读 · 0 评论 -
hdu 1285 确定比赛名次 (浙大拓扑排序模板)
忘记了memset一下,WA了数次 #include using namespace std; const int maxn=500+10; int map[maxn][maxn],p[maxn]; int toposort(int n,int mat[][maxn],int *ret){ int d[maxn],i,j,k; for(i=0;i<n;i++) f原创 2012-01-20 22:02:17 · 1091 阅读 · 0 评论 -
hdu 1811 rank of tetras 拓扑排序+并查集
这题写了几天了,好几次写了一半又删了的,发现拓扑还是用queue好啊 1.3种结果的优先关系conflict>uncertain>ok,只要是conflict就不是看后两者了,如果不是只有判了是uncertain就不看是否ok了,用solve()函数返回结果的情况 2.q.size()>1,同时多个点入度为0,uncertain.(要=判断了conflict才确定) 入q次数与n'不等则原创 2012-01-23 13:53:16 · 727 阅读 · 0 评论