Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <map>#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;int gint(){char c; int f=1;while(c=getchar(),c<48||c>57)if(c=='-')f=-1;int x=0;for(;c>47&&c<58;c=getchar()){x=x*10+c-48;}return x*f;}#define max_N 100005#define Mod 1000000007int eu[max_N],ev[max_N];struct edge{int v,n;edge(int v=0,int n=0):v(v),n(n){}}e[max_N<<1];int head[max_N],tot,d[max_N];void add_edge(int u,int v){e[++tot]=edge(v,head[u]),head[u]=tot;