其他分享
首页 > 其他分享> > 压位二分图匹配

压位二分图匹配

作者:互联网

\(\mathcal O\left(\dfrac{n^3}{\omega}\right)\)

(偷懒写法)

bitset<N> nvis, G[N];

bool match(int u) {
  for (int i = (G[u] & nvis)._Find_first(); i != N; i = (G[u] & nvis)._Find_next(i))
    if (!mat[i] || (nvis[i] = false, match(mat[i])))
      return mat[i] = u, true;
  return false;
}

标签:二分,nvis,false,mat,int,压位,return,匹配,match
来源: https://www.cnblogs.com/RiverHamster/p/bipartie-matching-bitmask.html