#abc236h. Ex - Distinct Multiples

Ex - Distinct Multiples

Score : 600600 points

问题描述

给定正整数 NNMM 和一个正整数序列 D=(D1,,DN)D = (D_1, \dots, D_N)

求满足以下条件的正整数序列 A=(A1,,AN)A = (A_1, \dots, A_N) 的个数,结果对 998244353998244353 取模。

  • 1AiM(1iN)1 \leq A_i \leq M \, (1 \leq i \leq N)
  • AiAj(1i<jN)A_i \neq A_j \, (1 \leq i < j \leq N)
  • 对于每个 i(1iN)i \, (1 \leq i \leq N),有 AiA_iDiD_i 的倍数。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Given are positive integers NN, MM, and a sequence of positive integers D=(D1,,DN)D = (D_1, \dots, D_N).

Find the number of sequences of positive integers A=(A1,,AN)A = (A_1, \dots, A_N) that satisfy the following conditions, modulo 998244353998244353.

  • 1AiM(1iN)1 \leq A_i \leq M \, (1 \leq i \leq N)
  • AiAj(1i<jN)A_i \neq A_j \, (1 \leq i \lt j \leq N)
  • For each i(1iN)i \, (1 \leq i \leq N), AiA_i is a multiple of DiD_i.

Constraints

  • 2N162 \leq N \leq 16
  • 1M10181 \leq M \leq 10^{18}
  • 1DiM(1iN)1 \leq D_i \leq M \, (1 \leq i \leq N)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

D1D_1 \ldots DND_N

Output

Print the answer.

Sample Input 1

3 7
2 3 4

Sample Output 1

3

The three sequences AA that satisfy the conditions are (2,3,4),(2,6,4),(6,3,4)(2, 3, 4), (2, 6, 4), (6, 3, 4).

Sample Input 2

3 3
1 2 2

Sample Output 2

0

No sequence AA satisfies the conditions.

Sample Input 3

6 1000000000000000000
380214083 420492929 929717250 666796775 209977152 770361643

Sample Output 3

325683519

Be sure to find the count modulo 998244353998244353.

update @ 2024/3/10 10:14:52