Problem Solving Ideas:
Enumerates all the squares on the board, and if the point is deleted, the maximum number of matches is reduced, then the point is the key point.
#include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <vector > #include <algorithm>using namespace std;const int maxn = + 10;int g[maxn][maxn];int vis[maxn];int MATCH[MAXN ];int N, M, k;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 Maxmatch () {int res = 0; memset (Match,-1, sizeof (match)); for (int i=1;i<=n;i++) {memset (Vis, 0, sizeof (VIS)); if (path (i)) res++; } return res; int main () {int kcase = 1; while (scanf ("%d%d%d", &n, &m, &k)!=eof) {int x, y; memset (g, 0, sizeof (g)); for (int i=1;i<=k;i++) {scanf ("%d%d", &x, &y); G[x][y] = 1; } int ans = 0; int ACC= Maxmatch (); for (int i=1;i<=n;i++) {for (int j=1;j<=m;j++) {if (G[i][j]) {G[i][j] = 0; if (ACC > Maxmatch ()) ans++; G[I][J] = 1; }}} printf ("Board%d has%d important blanks for%d chessmen.\n", kcase++, ans, acc); } return 0;}
HDU 1281 board game (two-part chart matching)