#include<iostream> #include<cstring> using namespace std; ,INF=0x3f3f3f3f; int f[N][N]; int main() { int n,m; cin>>n>>m; memset(f,0x3f,sizeof f); int x,y; ;i<m;i++) { cin>>x>>y; //x>y f[x][y]=; //x<y f[y][x]=-;…
题意:牛有强弱,给出一些牛的强弱的胜负关系,问可以确定几头牛的排名. 思路: Floyd传递闭包 // by SiriusRen #include <bitset> #include <cstdio> using namespace std; #define f(x) for(int x=1;x<=n;x++) bitset<105>map[105]; int n,m,jyx,jyy,ans=0; int main(){ scanf("%d%d"…
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 a certain constant skill rating that is unique among the competitors. The contest is conduct…
题意 有n(1<=n<=100)个学生参加编程比赛. 给出m条实力信息.(1<=M<=4500) 其中每一条的格式为 A B (1<=A<=N,1<=B<=N,A!=B) 意思是A的实力比B强. 如果A比B强且B比C强,那么A一定比C强. 问最后有多少名学生可以确定他的排名. 保证输入信息不存在矛盾 题解 n<=100!!! 若A强于B则A向B连一条单向边 直接强行floyed判断连通性,如果这个点能到达的点数和能到达它的点数和为n-1则说明它的排名是…
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…
1612: [Usaco2008 Jan]Cow Contest奶牛的比赛 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 891  Solved: 590[Submit][Status][Discuss] Description FJ的N(1 <= N <= 100)头奶牛们最近参加了场程序设计竞赛:).在赛场上,奶牛们按1..N依次编号.每头奶牛的编程能力不尽相同,并且没有哪两头奶牛的水平不相上下,也就是说,奶牛们的编程能力有明确的排名. 整个比…
是一道floyd变形的题目.题目让确定有几个人的位置是确定的,如果一个点有x个点能到达此点,从该点出发能到达y个点,若x+y=n-1,则该点的位置是确定的.用floyd算发出每两个点之间的距离,最后统计时,若dis[a][b]之间无路且dis[b][a]之间无路,则该点位置不能确定.最后用点个数减去不能确定点的个数即可.题目: Cow Contest Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4813   Accep…
题意:Farmer John想按照奶牛产奶的能力给她们排序.现在已知有N头奶牛(1 ≤ N ≤ 1,000).FJ通过比较,已经知道了M(1 ≤ M ≤ 10,000)对相对关系.每一对关系表示为"X Y",意指X的产奶能力强于Y.现在FJ想要知道,他至少还要调查多少对关系才能完成整个排序. 思路: bitset+Floyd传递闭包. // by SiriusRen #include <bitset> #include <cstdio> using namesp…
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 a certain constant skill rating that is unique among the competitors. The contest is conduct…
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…