QOJ.ac

QOJ

시간 제한: 1 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓

#13967. 猫巴士规划

통계

猫巴士

你是即将到来的猫巴士(Catbus)路线规划委员会的成员。有 $k$ 辆猫巴士,你的任务是为它们每辆车选择一条路线。有 $n$ 个城市和它们之间的 $m$ 条双向道路。一条猫巴士路线是一条由至少一条道路组成的路径。此外,猫巴士最多只会经过每条道路一次,因为它们喜欢探索新鲜的路径!

为了避免漏掉任何人,必须确保每条道路都至少被包含在一条猫巴士的路线中。此外,猫巴士在相遇时可能会表现得具有攻击性,因此必须确保没有任何两条猫巴士路线共享同一条道路。但是,猫巴士路线可以共享相同的城市。

确定是否可以创建 $k$ 条路线。如果可以,输出字符串 "Possible",紧接着输出这 $k$ 条路线。否则,输出字符串 "Impossible"。

输入格式

输入的第一行包含三个空格分隔的整数 $n$、$m$ 和 $k$ ($1 \le n, m, k \le 100\,000$),分别代表城市的数量、道路的数量和猫巴士的数量。

接下来的 $m$ 行,每行包含两个空格分隔的整数 $a_i, b_i$ ($1 \le a_i, b_i \le n, a_i \ne b_i$),表示第 $i$ 条道路连接城市 $a_i$ 和 $b_i$。

输出格式

如果无法找到 $k$ 条猫巴士路线,输出字符串 "Impossible"。

否则,输出 $k + 1$ 行。输出的第一行应为字符串 "Possible",对于 $i = 2, \dots, k + 1$,第 $i$ 行应包含第 $i - 1$ 辆猫巴士在其路线中按顺序访问的城市列表。

样例

样例输入 1

4 3 4
1 2
1 3
2 4

样例输出 1

Impossible

样例输入 2

4 3 2
1 2
1 3
4 2

样例输出 2

Possible
1 2 4
1 3

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.