kuangbin_ShortPath H (POJ 3660)】的更多相关文章

本来想自己写个bfs让他顺着胜负边爬 走到拐弯处就判定无法确定次序 然后我发现有多余的边并不会自己省略掉 要写个O(n^3)的删掉多余边这都不如Floyd了 看奚政学长写的是拓扑序也能解 然后在理解看他的文章的时候智商下线了 Floyd都没认出来 最后自己写了个(标准)Floyd 华丽得wa了 然后查出来是i j k 次序写的不好 嗯原始算法还是要复习一下的 有空去学一下拓扑序解法 以上 #include <cstdio> #include <cstring> int main()…
链接:poj 3660 题意:给定n头牛,以及某些牛之间的强弱关系.按强弱排序.求能确定名次的牛的数量 思路:对于某头牛,若比它强和比它弱的牛的数量为 n-1,则他的名次能够确定 #include<stdio.h> #include<limits.h> int a[110][110]; int main() { int n,m,i,j,k,s,sum; while(scanf("%d%d",&n,&m)!=EOF){ for(i=1;i<=…
Cow Contest Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3660 Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some co…
POJ 3660 Cow Contest / HUST 1037 Cow Contest / HRBUST 1018 Cow Contest(图论,传递闭包) Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has…
Cow Contest POJ - 3660 :http://poj.org/problem?id=3660   参考:https://www.cnblogs.com/kuangbin/p/3140837.html   题意: n头牛,有m对牛进行了比赛,现在告诉你每队牛比赛的结果,A胜B,问有几头牛的排名可以确定. 思路: 题目给出了m对的相对关系,求有多少个排名是确定的. 使用floyed求一下传递闭包.如果这个点和其余的关系都是确定的,那么这个点的排名就是确定的. #include <al…
题目链接:http://poj.org/problem?id=3660 Cow Contest Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10066   Accepted: 5682 Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all kn…
http://poj.org/problem?id=3660 题目大意:n头牛两两比赛经过m场比赛后能判断名次的有几头可转 化为路径问题,用Floyd将能够到达的路径标记为1,如果一个点能 够到达剩余你n - 1个点则能判断该点的名次 #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<queue> #define INF 0x3f3f…
题目链接:http://poj.org/problem?id=3660 Description N ( ≤ N ≤ ) cows, conveniently numbered ..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is unique am…
题目链接: http://poj.org/problem?id=3660 题目大意: 给出n头牛,m个关系,关系为a的战力比b高.求最后可以确定排名的牛的数量 思路: 1.如果一头牛跟其他所有牛都确定了一个输赢关系,那么该牛的排名就得到了确定,所以用floyd跑一遍传递闭包.然后求得每个点的出度(赢了), 入度(输了).若该点的度之和为 n - 1 ,即确定排名. #include<stdio.h> #include<string.h> #define mem(a, b) mems…
Cow Contest Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5989   Accepted: 3234 Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others…