#P10704. 救赎(Redemption)

救赎(Redemption)

Background

Lord,Lord, isthispersonalsosomeonewemustsave…is this person also someone we must save\dots $$May my barrage of bullets put out your suffering\dots$$$$If you see an angel who gives off an ominous aura,$$pleasetellherforme:please tell her for me: Ihaveneverforgottenher…I have never forgotten her\dots

Problem Description

Given nn, mm, and nn integers aia_i (1≤i≤n1 \le i \le n).

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 998244353998244353.

Input Format

The first line contains two integers nn and mm.

The second line contains nn integers a1,a2…ana_1, a_2 \dots a_n.

Output Format

Output one integer, the result modulo 998244353998244353.

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 nn mm aia_i Score Special Property
00 ≤102\le 10^2 ≤106\le 10^{6} ≤105\le 10^5 1010 −-
11 ≤104\le 10^4 ≤1010\le 10^{10} ≤109\le 10^9
22 ≤106\le 10^6 ≤104\le 10^4
33 ≤108\le 10^8 ≤109\le 10^9 2020
44 ≤1010\le 10^{10} AA
55 3030 −-

Special property AA: ∑i=1nai≤107\sum\limits_{i=1}^{n} a_i \le 10^7.

For 100%100\% of the testdata: 1≤n≤1061 \le n \le 10^6, 1≤ai≤1091 \le a_i \le 10^9, ∑i=1nai≤109\sum\limits_{i=1}^{n} a_i \le 10^9, and 1≤m≤10101 \le m \le 10^{10}.

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