Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<cstdio>#include<iostream>#include<cstdlib>#include<algorithm>#include<cstring>#include<cmath>#include<map>#include<stack>#include<queue>#include<set>#include<vector>using namespace std;typedef long long ll;typedef double db;const int MAXN = 20020;const int MAXM = 100010;struct Edge{int to,next;} edge[MAXM];int head[MAXN],tot;void init(){tot = 0;memset(head,-1,sizeof(head));}void addedge(int u,int v){edge[tot].to = v;edge[tot].next = head[u];head[u] = tot++;