1
2
3
4
5
6
7
8
9
10
#include<cstdio>
const int MAXn = 1e4;
const int MAXm = 1e4 * 2;//无向图MAXM应开边数二倍

int head[MAXn + 10], cntnex, nex[MAXm * 2 + 10], to[MAXm * 2 + 10];
void Insert(int u, int v) {
nex[++cntnex] = head[u];
head[u] = cntnex;
to[cntnex] = v;
}