链接:
与上题(H)相似
代码:
#include#include #include #include using namespace std;#define N 510#define INF 0x3f3f3f3f// un是匹配左边的定点数, vn是匹配右边的定点数int n, un, vn, used[N], p[N], Hash[N][N], g[N][N];char G[N][N];//匈牙利算法, 从左边开始找增广路int Find(int u){ for(int j=0; j 0 && G[i-1][j]=='#') g[Hash[i][j]][Hash[i-1][j]]=1; if(i 0 && G[i][j-1]=='#') g[Hash[i][j]][Hash[i][j-1]]=1; if(j