分类: 模版例题

1 篇文章

CF156D Clues(Prufer序)
题目大意 给定一个 $n$ 个点 $m$ 条边的带标号无向图,它有 $k$ 个连通块,求添加 $k-1$ 条边使得整个图连通的方案数,答案对 $p$ 取模。$(1 \le n \le 10^5, 0 \le m \le 10^5, 1 \le k \le 10^9)$ 解题思路 设 $s_i$ 为第 $i$ 个连通块的点数, $d_i$ 为第 $i…

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny