QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100 难度: [顯示]

#16355. Andarzgu

统计

Kasra 和 Arshia 最近经常一起通勤,Arshia 把他带坏了。他们开车……

等等,等等,等等……为什么故事这么长?

我们有一个有向图,我们想从中选择一个有向简单环的序列,使得没有任何顶点出现在多于一个环中。并且,我们可以从图中的某个节点出发,依次经过这些环。这意味着我们应该能够从起点到达第一个环,然后能够利用图中的边从任意一个环到达下一个环。请注意,在从一个环到下一个环的过程中所经过的顶点并不重要,且在这些路径中多次经过某些顶点也是可以的。

现在我们想知道,有多少种选择这些环的方法?由于这个问题可能有点困难,你只需要确定答案的奇偶性即可。

注意,该序列可以为空。两种选择环的方法不同,当且仅当这两种方法所选择的环的集合不同。

输入格式

输入第一行包含两个整数 $n$ 和 $m$,分别表示图的顶点数和边数。

接下来的 $m$ 行,每行给出图的一条边。

输出格式

如果答案的奇偶性为偶数,输出字符串 "Daddy: We should have a date...";如果奇偶性为奇数,输出字符串 "Mistletoe: Time to go home!"

数据范围

  • $1 \le n \le 5000$
  • $0 \le m \le \min \left( \binom{n}{2}, 10^6 \right)$
  • $1 \le u_i, v_i \le n$

子任务

子任务 得分 限制
1 13 无向基图是一棵仙人掌¹
2 36 $1 \le n \le 500$
图是强连通的。
3 51 无额外限制

¹ 仙人掌是一个无向图,其中任意两个环最多只有一个公共顶点。

样例

输入样例 1

4 4
3 1
1 2
3 4
2 3

输出样例 1

Daddy: We should have a date...

输入样例 2

6 8
1 4
1 2
4 5
5 1
6 2
2 3
3 1
6 1

输出样例 2

Mistletoe: Time to go home!

输入样例 3

12 16
8 6
1 2
7 8
10 11
1 4
4 5
11 12
5 1
1 6
12 10
2 3
6 9
3 1
6 7
9 8
5 10

输出样例 3

Daddy: We should have a date...

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

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.