#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxm = 40010; const int maxn = 1010; int first[maxn], cnt; struct edge { int u, v, next; }e[maxn*maxn]; int ans[maxm]; bool vis[maxm]; int len; void AddEdge(int u, int v) { e[cnt].u = u; e[cnt].v = v; e[cnt].next = first[u]; first[u] = cnt++; } void dfs(int u) { for(int i = first[u]; i != -1; i = e[i].next) { if(!vis[i]) { vis[i] = true; dfs(e[i].v); ans[len++] = i; } } }
时间: 2024-10-10 07:31:39