博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
bzoj 2763 [JLOI2011]飞行路线 Dijikstra 分层
阅读量:7235 次
发布时间:2019-06-29

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

k<=10,所以每用一次机会就跳到一个新图中,

每一个图按原图建边,相邻两图中建边权为0的边

补一补dj,好像我以前觉得dj特别难,hhhhh

#include
#include
#include
#include
#include
#include
#define N 500500using namespace std;int n,m,k,S,T;struct point{ int st,dis; bool operator < (const point &a)const{ return dis>a.dis; }}p[N];int e=1,head[N],dis[N];bool bo[N];struct edge{ int u,v,w,next;}ed[5000500];void add(int u,int v,int w){ ed[e].u=u; ed[e].v=v; ed[e].w=w; ed[e].next=head[u]; head[u]=e++;}priority_queue
q;int dijkstra(){ memset(dis,0x7f,sizeof dis); memset(bo,0,sizeof bo); dis[S]=0;q.push((point){S,0}); while(!q.empty()){ point now=q.top();q.pop(); if(bo[now.st]) continue; bo[now.st]=1; for(int i=head[now.st];i;i=ed[i].next) if(dis[now.st]+ed[i].w

转载于:https://www.cnblogs.com/Ren-Ivan/p/7746701.html

你可能感兴趣的文章
JavaScript数组增删改查知识梳理
查看>>
日常抄书之React中Diff算法思路
查看>>
(二)大型互联网分布式企业微服务云架构
查看>>
初探和实现websocket心跳重连
查看>>
宁撞金钟一下,不打破鼓三千,IT人要有志气,要进就进大的好的公司
查看>>
实现一个jQuery的API
查看>>
Python学习教程(Python学习路线):Day11-文件和异常
查看>>
证书更新
查看>>
移动端swiper嵌iframe无法滑动的解决方案
查看>>
spring cloud构建互联网分布式微服务云平台- hystrix工作原理
查看>>
立即执行函数
查看>>
腾讯X5内核集成一些建议和爬坑记录
查看>>
直接使用 x y 调用frame的x y 值
查看>>
iOS富文本的简单使用
查看>>
云栖专辑| 阿里毕玄:程序员的成长路线
查看>>
Redis分布式缓存安装和使用
查看>>
Python 工匠:使用数字与字符串的技巧
查看>>
MyBatis和Hibernate相比,优势在哪里?
查看>>
C# WIN32 API
查看>>
samba服务简单配置使用
查看>>