前向星总结

晚上补嘻嘻嘻跑步去了

#include<iostream>
#include<cstdio>

using namespace std;

struct Edge{
    int w;
    int to;
    int next;
};

const int maxn = 100010;
const int maxm = 200010;
int top,n,m;
int head[100010];
struct Edge edge[maxm];

int t1,t2,t3;

inline void add(int u,int v,int w){
    edge[top].to = v;
    edge[top].w = w;
    edge[top].next = head[u];
    head[u] = cnt++;
}


int main(){
    while(scanf("%d%d",&n,&m) != EOF){
        top = 0;
        memset(head,-1,sizeof(head));
        for(int i = 0;i < m;i++){
            scanf("%d%d%d",t1,t2,t3);
            add(t1,t2,t3);
        }
        
        
        
        
        
        
    }
    
    
    
    return 0;
}


猜你喜欢

转载自blog.csdn.net/qq_37136305/article/details/81635951