#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
  
#define MAXM 500010
#define MAXN 10010
#define ANS_MAX 2147483647
  
struct EDGE {
    int next;
    int to;
    int w;
};
EDGE edge[MAXM];
  
int n, m;
int head[MAXN];
  
  
inline int Read() {
    char c; int ans = 0; bool Sign = false;
    while(!isdigit(c=getchar()) && c != '-');
    if(c == '-') {
        Sign = true;
        c = getchar();
    }
    do {
        ans = (ans<<3) + (ans<<1) + (c ^ '0');
    } while(isdigit(c=getchar()));
    return Sign ? -ans : ans;
}
  
void Add(int u, int v, int w) {
    edge[++cnt].next = head[u];//指向上一个输入的x的边
    edge[cnt].to = v;
    edge[cnt].w = w;//权值
    head[u] = cnt;//记录
}
  
void read() {
    int x, y, w;
    n = Read();
    m = Read();
    for(int i=1; i<=m; i++) {
        x = Read();
        y = Read();
        w = Read();
        Add(x, y, w);
    }
}
  

        for(int i=head[k]; i!=0; i=edge[i].next) {
            int j = edge[i].to;
        }
   

发表评论

邮箱地址不会被公开。 必填项已用*标注