分层图最短路
同这道题,稍微改一改就好了。
代码:
#include<queue>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 5005
#define M 500005
#define F inline
using namespace std;
struct edge{
int nxt,to,d; }ed[M<<1];
struct P{
int x,d; };
int n,m,k,p,s,t,ans=1e9,h[N],d[N];
priority_queue <P> q;
F char readc(){
static char buf[100000],*l=buf,*r=buf;
if (l==r) r<