Question :............ Train of Thought: Calculate the least point set by the anti-key edge to overwrite the key. boys + girls-key is the answer. After Anti-edge construction, each edge represents the minimum point set that the boy and the girl do not know, after removing these vertices, all the anti-built edges are removed, and the rest is that men and women know each other .. AC code: [cpp] # include <iostream> # include <cstdio> # include <cstring> using namespace std; const int Max = 300; bool use [Max]; int link [Max]; bool map [Max] [Max]; void init () {memset (map, true, sizeof (map);} bool Dfs (int k, int m) {int I, j; for (I = 1; I <= m; I ++) {if (map [k] [I] & use [I]) {use [I] = false; if (! Link [I] | Dfs (link [I], m) {link [I] = k; return true ;}} return false ;} int MaxMatch (int n, int m) {int I, j; int ans = 0; memset (link, 0, sizeof (link); for (I = 1; I <= n; I ++) {memset (use, true, sizeof (use); if (Dfs (I, m) ans ++;} return ans;} int main () {int I, j, n, m, k; int ncase = 1; while (scanf ("% d", & n, & m, & k) & (n + k + m) {init (); while (k --) {scanf ("% d", & I, & j ); map [I] [j] = false;} printf ("Case % d:", ncase ++); printf ("% d \ n ", n + m-MaxMatch (n, m);} return 0 ;}