Advertisement

dijkstra队列优化链式前向星(C++ Java)

阅读量:

C++

复制代码
    #include <iostream>
    #include <queue>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    
    using namespace std;
    
    const int maxm = 4010;  //边
    const int maxn = 1010; //点
    const int inf = 0x3f3f3f3f;
    
    struct Edge
    {
    int to,v,next;
    } edge[maxm];
    struct node
    {
    int num, val; //存编号 和距离
    node(int _num=0, int _val=0):num(_num), val(_val) {}
    bool operator <(const node &tmp) const
    {
        return val > tmp.val;
    }
    };
    int head[maxn];
    int top;
    int n,m;
    int dis[maxn

全部评论 (0)

还没有任何评论哟~