Luogu P3489 [POI2009]WIE-Hexer 最短路

https://www.luogu.org/problemnew/show/P3489

普通的最短路,不过我觉得这个复杂度按道理来说边数不应该是m*2^13吗,不知道是数据比较水还是实际上能证明复杂度低一些。

代码如下

#include
using namespace std; 
const int maxn = 210; 
#define pa pair
int n,m,p,k;
int dis[maxn][8200]={},kn[maxn]={};
bool vis[maxn][8200]={};
priority_queue< pa , vector< pa > , greater< pa > >q;
struct en{
	int y,v,t,next;
}e[8000];
int head[maxn]={},tot=0;
void init(int x, int y, int v, int t){
	e[++tot].next=head[x]; e[tot].y=y;
	e[tot].t=t; e[tot].v=v; head[x]=tot;
}
void dji(){
	q.push(make_pair(0,8200+kn[1]));dis[1][kn[1]]=0;
	int flag=0,ans=dis[2][0];
	while(!q.empty()){
		int x=q.top().second;
		int knf=x%8200;x/=8200;q.pop();
		if(x==n){flag=1;cout<

  

转载于:https://www.cnblogs.com/137shoebills/p/11055175.html

你可能感兴趣的:(Luogu P3489 [POI2009]WIE-Hexer 最短路)