博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU1285-确定比赛名次(拓扑+优先队列)
阅读量:3897 次
发布时间:2019-05-23

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

对于拓扑排序,每次能入队的只有入度为0的点,所以用优先队列即可。

以及,第一组数据日常卡OJ,这组数据跳了一个点,我的程序这个版本也过不了(其实写了另一个版的),稍微改改更正确。

#include 
using namespace std;const int maxn=510;vector
vec[maxn];int indeg[maxn],seq[maxn],N,M,tot=0;void topo(){
tot=0; priority_queue
,greater
> pq; for (int i=1;i<=N;i++) {
if (indeg[i]==0) {
pq.push(i); } } while (!pq.empty()) {
int u=pq.top(); pq.pop(); seq[tot++]=u; for (int i=0;i

转载地址:http://iruen.baihongyu.com/

你可能感兴趣的文章
Emacs学习笔记(1):初学者的学习计划
查看>>
Emacs学习笔记(13):在Emacs中打开pdf
查看>>
Emacs学习笔记(14):在Emacs中使用git
查看>>
Emacs for vim Users---from http://www.crazyshell.org/blog/
查看>>
静态库和动态库链接那些事--http://www.crazyshell.org/blog/?p=50
查看>>
使用samba实现linux,windows间文件共享
查看>>
多线程调试必杀技 - GDB的non-stop模式
查看>>
一年成为Emacs高手(像神一样使用编辑器) .--http://blog.csdn.net/redguardtoo/article/details/7222501
查看>>
GNU make 指南
查看>>
配置 vim
查看>>
CentOS6.3 minimal SSH中文显示
查看>>
centos 安装emacs24
查看>>
【转】结构体中Char a[0]用法——柔性数组
查看>>
结构体最后定义一个char p[0];这样的成员有何意义(转)
查看>>
一步一学Linux与Windows 共享文件Samba (v0.2b)
查看>>
Linux 下忘记root密码怎么办
查看>>
Linux软件下载源码编程文章资料周立发--之调试
查看>>
GIT分支管理是一门艺术
查看>>
Cscope在emacs中的配置与使用
查看>>
emacs 2.4安装问题 ecb
查看>>