二分图
1 bool dfs(int x) { 2 for (int i = head[x], y; i; i = next[i]) 3 if (!visit[y = ver[i]]) { 4 visit[y] = 1; 5 if (!match[y] || dfs(match[y])) { 6 match[y]=x; 7 return true; 8 } 9 } 10 return false; 11 }
2024-03-15 17:25:18
1 bool dfs(int x) { 2 for (int i = head[x], y; i; i = next[i]) 3 if (!visit[y = ver[i]]) { 4 visit[y] = 1; 5 if (!match[y] || dfs(match[y])) { 6 match[y]=x; 7 return true; 8 } 9 } 10 return false; 11 }