建邻接表喽~~~

写个类,以后到这里找就行。^_^

const int M = 5024;

struct node {
    int to;
    int val;
    int next;
} g[N<<1];

class Graph {
public:
    int head[M], t;

    void init() {
        CL(head, 0XFF); t = 0;
    }

    void add(int u, int v, int w) {
        g[t].to = v; g[t].val = w; g[t].next = head[u];
        head[u] = t++;
    }
} G;
原文地址:https://www.cnblogs.com/vongang/p/2653608.html