Problem Solving Ideas:
The above requirements for the minimum point coverage, the minimum point coverage = = Maximum match, to note that the initial mode 0, no consumption, so mode 0 does not need to connect the edge.
#include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include < algorithm> #include <vector> #include <cmath> #include <queue> #include <map> #define LL Long Long#define for (i, X, y) for (int i=x;i<=y;i++) using namespace std;const int maxn = x + 10;int g[maxn][maxn];int vis[m Axn];int match[maxn];int N, m;int path (int u) {for (int v=1;v<m;v++) {if (G[u][v] &&!vis[v]) {Vis[v] = 1; if (match[v] = = 1 | | path (MATCH[V])) {Match[v] = u; return 1; }}} return 0;} int main () {while (scanf ("%d", &n)!=eof) {if (n = = 0) break; int k; scanf ("%d%d", &m, &k); int x, u, v; memset (g, 0, sizeof (g)); while (k--) {scanf ("%d%d%d", &x, &u, &v); if (U > 0 && v > 0) g[u][v] = 1; } mEmset (Match,-1, sizeof (match)); int ans = 0; for (int i=1;i<n;i++) {memset (Vis, 0, sizeof (VIS)); Ans + = path (i); } printf ("%d\n", ans); } return 0;}
HDU 1150 Machine Schedule (binary graph matching)