POJ 1094 Sorting It All Out(拓扑排序)
来源:互联网 发布:黑魂3妹子捏脸数据 编辑:程序博客网 时间:2024/04/25 12:06
题意:n个字母排序,给定m个关系,输出
①在得到几个关系后确定排序(全序)
②在得到几个关系后出现矛盾,有环
③不能得到确定的排序(偏序)
思路:直白的拓扑排序,但很多要注意的地方
1)每读入一个关系做一次拓扑排序
找入度为0点u,确定位置,使u指向的点的入度减1,再找入度为0的点...
未排完序就找不到入度为0的点则有环,找到入度为0的点多于1个则关系不能确定
2)在可以确定①②两种情况后不再考虑后面的输入(我觉得确定了①之后还应该看看会不会②的,但看别人的题解都没有,自己加了一下看看,wa了)
3)拓扑排序时发现了不能确定关系后不能返回,继续操作可能发有环
0 0
- POJ 1094Sorting It All Out(拓扑排序)
- [ACM] POJ 1094 Sorting It All Out (拓扑排序)
- poj 1094 Sorting It All Out (拓扑排序)
- POJ 1094-Sorting It All Out(拓扑排序)
- POJ 题目1094Sorting It All Out(拓扑排序)
- poj 1094 Sorting It All Out(拓扑排序)
- POJ 1094 Sorting It All Out(拓扑排序)
- POJ-1094---Sorting It All Out(拓扑排序)
- POJ 1094 Sorting It All Out (拓扑排序)
- POJ 1094 -- Sorting It All Out (拓扑排序)
- POJ-1094-Sorting It All Out(拓扑排序)
- POJ 1094 Sorting It All Out(拓扑排序)
- POJ 1094 Sorting It All Out(拓扑排序)
- POJ-1094 Sorting It All Out (拓扑排序)
- POJ 1094 Sorting It All Out (拓扑排序)
- poj 1094 Sorting It All Out (拓扑排序)@
- poj 1094 Sorting It All Out(拓扑排序)
- poj 1094 Sorting It All Out(拓扑排序)
- SIFT SURF 特征提取
- linux objective-c 环境配置与多文件编译
- 新建的Android工程下目录的解释以及存放的内容
- 祝贺诺博源软件签订新三板挂牌上市合同
- android的ClassLoader
- POJ 1094 Sorting It All Out(拓扑排序)
- The Geometry Managers(The Grid Manager)
- Visual Studio开发小技巧一枚
- MinGW安装和使用基础教程
- 矩形的个数
- VC如何对新创建的一个线程暂停或重启
- linux服务器常用命令
- Quartz.NET学习系列(九)--- XML任务配置
- leetcode twosum