#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
#define MAXN 1024
struct NODE{
int w,nex,to; //to代表下一个点,w代表权值,nex代表下一条边
}edge[MAXN];//记录边
int headlist[MAXN];//记录点的第一条边
void read_graph(int x,int y,int z,int name){
edge[name].w=z;
edge[name].nex=headlist[x];
edge[name].to=y;
headlist[x]=name;
}//存图
int main(){
int n,m,i,b,e,v;
scanf(“%d %d”,&n,&m);
for(i=1;i<=m;i++){
scanf(“%d %d %d”,&b,&e,&v);
read_graph(b,e,v,i);
}
return 0;
}
前向星
最新推荐文章于 2022-11-05 16:01:24 发布