QOJ.ac

QOJ

Time Limit: 6.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#15848. Domination Devil

الإحصائيات

今天,支配恶魔要教我们如何征服一个岛国!你只需要记住这一点:不稳定性导致纯粹的混乱

这个国家有 $n$ 个不同的岛屿,按力量等级从 $1$ 到 $n$ 递增排列。最初,存在 $n(n-1)/2$ 座双向桥梁,每座桥直接连接两个不同的岛屿。

我们需要削弱这个国家的自卫能力,但必须以一种在技术上仍能维持其经济运作的方式进行。我们将选择桥梁的一个子集,并摧毁该子集中的每一座桥。当你摧毁一座桥时,它将不再可用。

在摧毁所选桥梁后,必须满足以下两个条件:

  • 摧毁每个岛屿的支撑结构。 每个岛屿直接连接的、力量等级高于它的岛屿数量最多只能有 $k$ 个。如果两个岛屿之间存在可用的桥梁,则称它们是直接连接的。
  • 仅保留维持运作所需的最低限度,使其仅靠一线生机维持。 仍然可以通过剩余的可用桥梁从任意一个岛屿到达其他任何岛屿。

给定 $n$ 和 $k$,计算满足摧毁所有这些桥梁后能同时满足上述两个条件的桥梁子集的数量。这个数字可能非常大,因此我们仅要求你输出答案对 $1699741697$ 取模的结果。

输入格式

输入包含一行,由空格分隔的整数 $n$ 和 $k$。

数据范围

  • $1 \le k < n \le 2 \cdot 10^5$

输出格式

输出一个整数,表示满足上述两个条件的子集数量,对 $1699741697$ 取模。

样例

输入 1

4 1

输出 1

6

输入 2

4 2

输出 2

30

输入 3

200000 1

输出 3

1581480553

输入 4

200000 100000

输出 4

1212906613

说明

令 $(u, v)$ 表示连接力量等级为 $u$ 和 $v$ 的岛屿的桥梁。如果 $n = 4$,则所有桥梁的集合为 $\{(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)\}$。当 $k = 1$ 时,以下摧毁桥梁的子集将使两个给定条件同时得到满足:

  • 摧毁 $(1, 3), (1, 4)$ 和 $(2, 3)$
  • 摧毁 $(1, 2), (1, 4)$ 和 $(2, 3)$
  • 摧毁 $(1, 2), (1, 3)$ 和 $(2, 3)$
  • 摧毁 $(1, 3), (1, 4)$ 和 $(2, 4)$
  • 摧毁 $(1, 2), (1, 4)$ 和 $(2, 4)$
  • 摧毁 $(1, 2), (1, 3)$ 和 $(2, 4)$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.