atcoder#AGC036C. [AGC036C] GP 2
[AGC036C] GP 2
Score : points
Problem Statement
We have a sequence of integers: . Initially, for each ().
Snuke will perform the following operation exactly times:
- Choose two distinct indices (). Then, replace with and with .
Find the number of different sequences that can result after operations. Since it can be enormous, compute the count modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of different sequences that can result after operations, modulo .
2 2
3
After two operations, there are three possible outcomes:
For example, can result after the following sequence of operations:
- First, choose , changing from to .
- Second, choose , changing from to .
3 2
19
10 10
211428932
100000 50000
3463133