#P10704. 救赎(Redemption)
救赎(Redemption)
Background
$$May my barrage of bullets put out your suffering\dots$$$$If you see an angel who gives off an ominous aura,$$
Problem Description
Given , , and integers ().
Compute:
$$\sum\limits_{i=1}^{n} \sum\limits_{j=1}^{n}\left \lfloor \frac{m}{a_i a_j} \right \rfloor$$Output the result modulo .
Input Format
The first line contains two integers and .
The second line contains integers .
Output Format
Output one integer, the result modulo .
5 30
2 2 8 4 2
88
10 5035239199
4853 53137 86933 4465 13588 11899 49877 16317 43326 52183
2715
Hint
Sample Explanation
The contributions in Sample 1 are as follows:
$(a_1, a_1): \left \lfloor \frac{30}{2\times 2} \right \rfloor = 7$.
$(a_1, a_2), (a_2, a_1): \left \lfloor \frac{30}{2\times 2} \right \rfloor \times 2 = 14$.
$(a_1, a_3), (a_3, a_1): \left \lfloor \frac{30}{2\times 8} \right \rfloor \times 2 = 2$.
$(a_1, a_4), (a_4, a_1): \left \lfloor \frac{30}{2\times 4} \right \rfloor \times 2 = 6$.
$(a_1, a_5), (a_5, a_1): \left \lfloor \frac{30}{2\times 2} \right \rfloor \times 2 = 14$.
$(a_2, a_2): \left \lfloor \frac{30}{2\times 2} \right \rfloor = 7$.
$(a_2, a_3), (a_3, a_2): \left \lfloor \frac{30}{2\times 8} \right \rfloor \times 2 = 2$.
$(a_2, a_4), (a_4, a_2): \left \lfloor \frac{30}{2\times 4} \right \rfloor \times 2 = 6$.
$(a_2, a_5), (a_5, a_2): \left \lfloor \frac{30}{2\times 2} \right \rfloor \times 2 = 14$.
$(a_3, a_5), (a_5, a_3): \left \lfloor \frac{30}{2\times 8} \right \rfloor \times 2 = 2$.
$(a_4, a_4): \left \lfloor \frac{30}{4\times 4} \right \rfloor = 1$.
$(a_4, a_5), (a_5, a_4): \left \lfloor \frac{30}{2\times 4} \right \rfloor \times 2 = 6$.
$(a_5, a_5): \left \lfloor \frac{30}{2\times 2} \right \rfloor = 7$.
$7 + 14 + 2 + 6 + 14 + 7 + 2 + 6 + 14 + 2 + 1 + 6 + 7 = 88$.
Constraints
| Subtask ID | Score | Special Property | |||
|---|---|---|---|---|---|
Special property : .
For of the testdata: , , , and .
Special note: This problem uses bundled subtask testing. You can only get the score for a subtask after passing all test points in that subtask.
Translated by ChatGPT 5