博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 1285 确定比赛名次
阅读量:4622 次
发布时间:2019-06-09

本文共 806 字,大约阅读时间需要 2 分钟。

题意:给出每两个队伍的胜负关系,求排名。

思路:裸裸的拓扑排序。

#include
#include
#include
using namespace std;int n,m,p1,p2;int indegree[500010],match[505][505],flag;void tuopu(){ int i,j,k,flag=0; for(j=1;j<=n;j++) for(i=1;i<=n;i++) { if(indegree[i]==0) { if(flag==0) printf("%d",i),flag++; else printf(" %d",i); indegree[i]=-1; for(k=0;k<=n;k++) { if(match[i][k]==1) indegree[k]--; } break;//一定要break掉 } } printf("\n");}int main(){ int i,j,k; while(scanf("%d%d",&n,&m)!=EOF) { memset(match,0,sizeof(match)); memset(indegree,0,sizeof(indegree)); for(i=0;i

转载于:https://www.cnblogs.com/jhcelue/p/6788779.html

你可能感兴趣的文章
poj 1654 && poj 1675
查看>>
运维派 企业面试题1 监控MySQL主从同步是否异常
查看>>
Docker 版本
查看>>
poj 1753 Flip Game
查看>>
在深信服实习是怎样的体验(研发测试岗)
查看>>
Linux免密码登陆
查看>>
SpringMVC中文件的上传(上传到服务器)和下载问题(二)--------下载
查看>>
Socket & TCP &HTTP
查看>>
osip及eXosip的编译方法
查看>>
Hibernate composite key
查看>>
[CF Round #294 div2] D. A and B and Interesting Substrings 【Map】
查看>>
keepalived+nginx安装配置
查看>>
我的2015---找寻真实的自己
查看>>
android编译遇到问题修改
查看>>
解决Ubuntu18.04.2远程桌面Xrdp登录蓝屏问题
查看>>
Git的安装和使用教程详解
查看>>
lsof命令详解
查看>>
常用模块,异常处理
查看>>
父窗口与子窗口之间的传值
查看>>
eclipse 找不到 tomcat 的解决方案
查看>>