#P9836. 种树

    ID: 9456 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>数学贪心洛谷原创O2优化洛谷月赛

种树

Background

Little Rf does not really like planting flowers, but he likes planting trees.

Problem Description

There are nn trees by the roadside. The height of each tree is a positive integer, denoted as p1,p2pnp_1, p_2 \dots p_n.

Define the width of a tree as the number of positive divisors of its height. The distance these trees can cover is the product of their widths. You want to invite your friends to enjoy the shade, but you find that the distance these trees can cover is not large enough.

So you buy a total of ww units of magic fertilizer. You may fertilize multiple times. Each time, you can use kk units of fertilizer (kk must be a positive divisor of the current amount of fertilizer), multiply the height of any one tree by kk, and at the same time your remaining fertilizer amount will be divided by kk. The tree chosen for each fertilization can be arbitrary, and the chosen trees do not need to be the same across operations.

You need to maximize the distance that these trees can cover, and output this maximum distance. Take the answer modulo 998244353998244353.

Input Format

Read input from standard input.

The first line contains two positive integers nn and ww.

The second line contains nn positive integers p1,p2pnp_1, p_2 \dots p_n.

Output Format

Write output to standard output.

Output one integer on a single line, representing the answer modulo 998244353998244353.

3 60
8 243 250
2304

Hint

[Sample 1 Explanation]

  • First fertilization: apply 1515 units of fertilizer to the first tree, making its height become 120120, with 44 units of fertilizer remaining.
  • Second fertilization: apply 44 units of fertilizer to the second tree, making its height become 972972, with 11 unit of fertilizer remaining.
  • At this time, the widths of the three trees are 16,18,816, 18, 8 respectively, and the distance they can cover is 23042304, which is the optimal solution.

[Sample 2]

See the attached files plant/plant2.in\texttt{plant/plant2.in} and plant/plant2.ans\texttt{plant/plant2.ans}.


[Sample 3]

See the attached files plant/plant3.in\texttt{plant/plant3.in} and plant/plant3.ans\texttt{plant/plant3.ans}.


[Constraints]

Test Point ID nn \leq pip_i ww Points
151 \sim 5 10410^4 =1=1 =1=1 11
6106 \sim 10 104\leq 10^4 33
111511 \sim 15 11 104\leq 10^4
162016 \sim 20 55 66
212521 \sim 25 10410^4 77

For 100%100\% of the testdata, it is guaranteed that 1n1041 \leq n \leq 10^4, 1pi1041 \leq p_i \leq 10^4, and 1w1041 \leq w \leq 10^4.

Translated by ChatGPT 5