先放代码:
#include <bits/stdc++.h>
using namespace std;
#define edgeN 5000005
#define pointN 1000005
#define infinity 2147483647
int pointnum,edgenum,startpoint,cnt(0),dis[pointN],vis[pointN],head[pointN];
struct node{
int distance_to_presentpoint,present_point;
inline bool operator <(const node &x) const{
return distance_to_presentpoint > x.present_point;
}
};
priority_queue<node>q;
//we usually use "pair< , >" here,why we use struct is to help us to understand the processes.
struct Edge{
int from,to,dis,next;
//"to" is the end spot of the edge.
//"next" is the edge after the present one.
}edge[edgeN];
inline int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9') if(ch=='-')f=-1,ch=getchar();
while(ch>='0'&&ch<'9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return x*f;