word is cheap,give me code
<span style="font-size:12px;">struct EDGE
{
int to,d;
bool operator < (cosnt EDGE& ed) const
{
return d < ed.d;
}
};
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
vector<EDGE>G[maxn];
int dis[maxn];
bool vis[maxn];
void add_edge(int from, int to, int d)
{
EDGE tmp;
tmp.to = to,tmp.d = d;
G[from].push_back(tmp);
tmp.to = from;
G[to].push_back(tmp);
}
void dijkstra(int u)
{
memset(dis,inf,sizeof(dis));
memset(vis,false,sizeof(vis));
dis[u] = 0;
priority_queue<EDGE,vector<EDGE>,greater<EDGE> >q;//小顶堆
EDGE tmp = (EDGE){u,dis[u]};
q.push(tmp);
int v,w;
while (!q.empty()) {
tmp = q.top();
q.pop();
v = tmp.to;
if (vis[v]) continue;
vis[v] = true;
for (int i = 0; i < G[v].size(); ++i) {
w = G[v][i].to;
if (!vis[w] && dis[w] > dis[v] + G[v][i].d) {
dis[w] = dis[v] + G[v][i].d;
q.push((EDGE){w,dis[w]});
}
}
}
}</span>