压位二分图匹配

\(\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;
}
posted @ 2022-01-03 16:17  RiverHamster  阅读(157)  评论(1编辑  收藏  举报
\