结构体什么的最优美了
#include#include template struct Graph { int top; struct Vertex{ int head; }V[N]; struct Edge{ int v,next; }E[M]; void init(){ memset(V,-1,sizeof(V)); top = 0; } void add_edge(int u,int v){ E[top].v = v; E[top].next = V[u].head; V[u].head = top++; } }; Graph<1000,10000> g; int main() { return 0; }
来自