#include<iostream>
#include<cstring>
#include<cstdio>
#define INF 0x7fffffff
using namespace std;
struct data{
int to,next,v;
}e[6000001];
int n,m,ne=1,ans,head[1000001],h[1000001],q[1000001];
void insert(int u,int v,int w){
e[++ne].to=v;
e[ne].next=head[u];
e[ne].v=w;
head[u]=ne;
}
bool bfs(){
memset(h,-1,sizeof(h));
h[1]=0;q[0]=1;
int i,now,t=0,w=1;
while(t<w){
now=q[t++];
i=head[now];
while(i){
......
阅读全文