#CF2239D. 猎兽 / D. Hunting the Beast
猎兽 / D. Hunting the Beast
猎兽
英文题名:D. Hunting the Beast
来源:Codeforces 2239D
比赛:Codeforces Round 1105 (Div. 1)
时间限制:2 seconds
空间限制:256 megabytes
题目描述
考虑 个点的无自环函数图。一个大小为 的起点集合若能沿有向边到达所有点,则称成功。图的价值为成功集合数。求所有 个函数图价值之和。
输入格式
第一行输入 。每组输入 。
输出格式
输出答案对 取模。
样例
5
2 1
3 1
3 2
4 2
8 3
2
12
18
216
20415360