题意:题目给出了m对的相对关系,求有多少个排名是确定的。

链接:点我

如果这个点到其他点的关系是确定的,那么这个点就是确定的,注意如果这个点到不了其他点,但其他点能到这个点,那么这个点和其他点的关系是确定的

样例图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqkAAAHlCAIAAABZNvIaAAAgAElEQVR4nO3dL9CrSJ/3YapWLJLaWpF1yMiIFZFUrYlEIpFIJA4ZGYlERiIxWxUZiURmHRLZMq/geXv6kNw5uROggf5camrmTPKbTNLfpv9adwAAYBJLdwEAAGBSZD8AAGYh+wEAMAvZDwCAWch+AADMQvYDAGAWsh8AALOQ/QAAmIXsBwDALGQ/AABmIfsBADAL2Q8AgFnIfgAAzEL2AwBgFrIfAACzkP0AAJiF7AcAwCxkPwAAZiH7AQAwC9kPAIBZyH4AAMxC9gMAYBayHwAAs5D9AACYhewHAMAsZD8AAGYh+wEAMAvZDwCAWch+AADMQvYDAGAWsh8AALOQ/QAAmIXsBwDALGQ/AABmIfsBADAL2Q8AgFnIfgAAzEL2AwBgFrIfAACzkP2ABmVZuq7rum6e57prAWAcsh/QYLPZWJZlWZZt27prAWAcsh+YWpZl1v8XRZHucgAYh+wHpiYf+oMg0F0LABOR/cCkLpdLF/yu6wohdJcDwERkPzCpMAy77E+SRHctAAxF9gMTads2jmM503+9XnVXBMBQZD8whSzLHMeRwX84HHRXBMBcZD8wOnVhfxf8zPQD0IjsB0YnF/ZzmA+AOSD7gXG1bSuf+HncBzAHZD8wot40v+5yAOB+J/uB8aRp2pvm110RANzvZD8wEjX4meYHMCtkPzA8dWH/Z6v6y7L0PI8eA4AxkP3A8OTC/o+383WvwC1/AMZA9gPD+35hP8sDAYyHlgUYmDrg//GLkP0AxkPLAgxskCt6yX4A46FlAQY2yEk+ZD+A8dCyAENSt/Z98zpkP4Dx0LIAg1GD/5sB/zvZD2BMtCzAML7f068i+wGMh5YFGIbneTKwoyhqmuabVyP7AYyHlgUYxul0sh64rhvH8Qf9ALIfwHhoWYDBFE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#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
#define MOD 1000000007
#define pb(a) push_back(a)
const int INF=0x3f3f3f3f;
const double eps=1e-;
typedef long long ll;
#define cl(a) memset(a,0,sizeof(a))
#define ts printf("*****\n");
const int MAXN=;
int n,m,tt,cnt;
int g[MAXN][MAXN];
int main()
{
int i,j,k;
#ifndef ONLINE_JUDGE
freopen("1.in","r",stdin);
#endif
while(scanf("%d%d",&n,&m)!=EOF)
{
int a,b;
cl(g);
for(i=;i<m;i++)
{
scanf("%d%d",&a,&b);
g[a][b]=;
}
for(k=;k<=n;k++)
for(i=;i<=n;i++)
for(j=;j<=n;j++)
if(g[i][k]==&&g[k][j]==) g[i][j]=;
int tot=;
for(i=;i<=n;i++)
{
bool flag=;
for(j=;j<=n;j++)
{
if(i==j) continue;
if(g[i][j]==&&g[j][i]==)
{
flag=;
break;
}
}
if(flag)
{
tot++;
}
}
printf("%d\n",tot);
}
}

poj 3660 传递闭包 **的更多相关文章

  1. POJ 3660 Cow Contest / HUST 1037 Cow Contest / HRBUST 1018 Cow Contest(图论,传递闭包)

    POJ 3660 Cow Contest / HUST 1037 Cow Contest / HRBUST 1018 Cow Contest(图论,传递闭包) Description N (1 ≤ N ...

  2. POJ 3660—— Cow Contest——————【Floyd传递闭包】

    Cow Contest Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit  ...

  3. POJ - 3660 Cow Contest 传递闭包floyed算法

    Cow Contest POJ - 3660 :http://poj.org/problem?id=3660   参考:https://www.cnblogs.com/kuangbin/p/31408 ...

  4. poj 3660 Cow Contest(传递闭包 Floyd)

    链接:poj 3660 题意:给定n头牛,以及某些牛之间的强弱关系.按强弱排序.求能确定名次的牛的数量 思路:对于某头牛,若比它强和比它弱的牛的数量为 n-1,则他的名次能够确定 #include&l ...

  5. POJ 3660 Cow Contest【Floyd 传递闭包】

    传送门:http://poj.org/problem?id=3660 题意:有n头牛, 给你m对关系.(a, b)表示牛a能打败牛b, 求在给出的这些关系下, 能确定多少头牛的排名. 传递闭包: 关系 ...

  6. POJ 3660 Cow Contest(传递闭包floyed算法)

    Cow Contest Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5989   Accepted: 3234 Descr ...

  7. (poj 3660) Cow Contest (floyd算法+传递闭包)

    题目链接:http://poj.org/problem?id=3660 Description N ( ≤ N ≤ ) cows, conveniently numbered ..N, are par ...

  8. POJ 3660 Cow Contest 传递闭包+Floyd

    原题链接:http://poj.org/problem?id=3660 Cow Contest Time Limit: 1000MS   Memory Limit: 65536K Total Subm ...

  9. poj 3660 Cow Contest (传递闭包)

    /* floyd 传递闭包 开始Floyd 之后统计每个点能到的或能到这个点的 也就是他能和几个人确定胜负关系 第一批要有n-1个 然后每次减掉上一批的人数 麻烦的很 复杂度上天了.... 正难则反 ...

随机推荐

  1. Hadoop上传文件时报错: could only be replicated to 0 nodes instead of minReplication (=1)....

    问题 上传文件到Hadoop异常,报错信息如下: org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /home/inpu ...

  2. RESTful记录-RESTful介绍

    RESTful Web服务是基于REST架构的Web服务.在REST架构一切都是一种资源. RESTful Web服务是轻量级的,高度可扩展性和可维护性,并且非常常用于创建基于API的Web应用程序. ...

  3. bzoj千题计划186:bzoj1048: [HAOI2007]分割矩阵

    http://www.lydsy.com/JudgeOnline/problem.php?id=1048 #include<cmath> #include<cstdio> #i ...

  4. Codeforces Round #519 题解

    A. Elections 题意概述 给出 \(a_1, \ldots, a_n\),求最小的 \(k (k \ge \max a_i)\), 使得 \(\sum_{i=1}^n a_i < \s ...

  5. spring Mvc Web 编码相关 [model 到 视图传递数据] (九)

    在某种编码环境,由bean注解的参数可能会发生乱码问题. 即可页面web.xml或其他地方都设备UTF-8, 但还是会有这样的问题. 首先不要使用model传到视图的数据. 第二,不要request. ...

  6. 20155325 2016-2017-2 《Java程序设计》第8周学习总结

    教材学习内容总结 NIO用于高级输入/输出处理 名称 衔接数据源与目的地 IO InputStream,OutputStream NIO Channel 类 方法 方法的作用 ReadableByte ...

  7. 跳过复制错误——sql_slave_skip_counter

    昨天不少同学讨论<小心,前方有雷 —— sql_slave_skip_counter>,有说作者在玩文字游戏,扯了那么多sql_slave_skip_counter=1不还是跳过一个事务嘛 ...

  8. j2ee组件简介

  9. Socket心跳包机制总结【转】

    转自:https://blog.csdn.net/qq_23167527/article/details/54290726 跳包之所以叫心跳包是因为:它像心跳一样每隔固定时间发一次,以此来告诉服务器, ...

  10. scp拷贝文件报错-bash: scp: command not found

    今天用scp远程传输资料,报错如下: -bash: scp: command not found 在网上搜资料解决办法如下: 安装scp的软件包: # yum install openssh-clie ...