很简单的模板题,不多说了
#include#include #include #define INF 0x3f3f3f3f#define MAXN 1000#define ll long longusing namespace std;struct Edge{ int u,v,cost;}edge[MAXN*40];int pre[MAXN],id[MAXN],vis[MAXN];ll in[MAXN]; ll zhuliu(int root,int n,int m){ ll res=0; while(1){ for(int i=0;i > N; for(int tt=1;tt<=N;tt++){ scanf("%d%d",&n,&m); for(int i=0;i