luogu#P9823. [ICPC2020 Shanghai R] The Journey of Geor Autumn
[ICPC2020 Shanghai R] The Journey of Geor Autumn
题目描述
Once upon a time, there was a witch named Geor Autumn, who set off on a journey across the world. Along the way, she would meet all kinds of people, from a country full of ICPC competitors to a horse in love with dota---but with each meeting, Geor would become a small part of their story, and her own world would get a little bit bigger.
Geor just arrived at the state of Shu where people love poems. A poem is a permutation of . ( is a permutation of means that each is an integer in and that are distinct.) One poem is if for all integer satisfying and , . Here denotes the minimum value among .
Help Geor calculate how many good poems there are, given and . To avoid huge numbers, output the answer modulo .
输入格式
The first line contains two integers and separated by a single space (, ).
输出格式
Output only one integer in one line---the number of good poems modulo .
题目大意
题意简述
给定 ,我们规定满足以下性质的 的排列称之为“好排列”:
$\forall k \min{a_{i-k},a_{i-k+1},...,a_{i-1}}$
求好排列的个数。对 取模。
输入格式
一行,两个整数 。
输出格式
一行,为好排列的个数对 取模的值。
1 1
1
2 3
2
3 2
4
4 2
10