atcoder#DWACON6THPRELIMSE. Span Covering
Span Covering
Score : points
Problem Statement
Niwango bought a piece of land that can be represented as a half-open interval .
Niwango will lay out vinyl sheets on this land. The sheets are numbered , and they are distinguishable. For Sheet , he can choose an integer such that and cover with this sheet.
Find the number of ways to cover the land with the sheets such that no point in remains uncovered, modulo . We consider two ways to cover the land different if and only if there is an integer such that the region covered by Sheet is different.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3 3
1 1 2
10
- If we ignore whether the whole interval is covered, there are ways to lay out the sheets.
- Among them, there are ways that leave uncovered, and ways that leave uncovered.
- Each of the other ways covers the whole interval , so the answer is .
18 477
324 31 27 227 9 21 41 29 50 34 2 362 92 11 13 17 183 119
134796357
- Find the number of ways modulo .