// 点数
#define PMAX 105
// 边数
#define EMAX 10005
int ecnt;
struct Edge {
int to, w, next;
} edge[EMAX];//边集
int head[PMAX];//head[i], i点出边链表
void init() {
for (int i = 0; i < PMAX; i++) head[i] = -1;
ecnt = 0;
}
void add_edge(int u, int v, int w) {
edge[ecnt].to = v; //终点
edge[ecnt].w = w; //权值
edge[ecnt].next = head[u];
head[u] = ecnt++;
/*
before
head[u] -> v1 -> v2 -> ... -> -1
after
head[u] -> v -> v1 -> v2 -> ... -> -1
*/
}
/*
for (int j = head[i]; j != -1; j = edge[j].next) //遍历i点的出边
printf("%d %d\\n", edge[j].to, edge[j].w);
*/