邻接表实现图(双向或无向)
struct Edge {
int to;
int l;
Edge(int x,int y):to(x),l(y) {}
};
int to;
int l;
Edge(int x,int y):to(x),l(y) {}
};
vector<Edge> graph[Max];
for(int i=0; i<m; i++) {
int from,to,l;cin>>from>>to>>l;
graph[from].emplace_back(Edge(to,l));
graph[to].emplace_back(Edge(from,l));
}