#P5401. [CTS2019] 珍珠
[CTS2019] 珍珠
Description
There are independent uniformly random integer variables in the range .
Find the probability that we can choose at least bottles, such that there exists a way to select some variables and put each selected variable into a bottle, satisfying that each bottle contains exactly two variables with the same value.
Output the value of the probability multiplied by , taken modulo . For the modulo details, refer to Problem 1.
Input Format
The input contains only one line with three integers separated by spaces.
Output Format
Output one integer, representing the required value of the probability multiplied by modulo .
2 2 1
2
8 10 4
301103104
998 1000 500
762913089
Hint
Sample 1 Explanation
Case : the first variable is , and the second variable is .
Case : the first variable is , and the second variable is .
Case : the first variable is , and the second variable is .
Case : the first variable is , and the second variable is .
In cases and , we can put the two variables into one bottle.
In cases and , the two variables have different values, so they cannot be put into the same bottle.
Testdata Convention

All test points satisfy $0 \leqslant m \leqslant 10^9,1 \leqslant n \leqslant 10^9,1 \leqslant D \leqslant 10^5$。
Translated by ChatGPT 5
京公网安备 11011102002149号