問題一覧 > 通常問題

No.1763 Many Balls

レベル : / AI推定難易度 : 2575 / 実行時間制限 : 1ケース 10.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 9
作問者 : PCTprobability / テスター : NyaanNyaan tokusakurai
お気に入りにしたユーザー ProblemId : 7111 / 自分の提出
問題文最終更新日: 2021-11-20 02:21:20
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 324 (順位表) の他の問題:

Problem Statement

You distribute $N$ distinguishable balls to $M$ people. Some balls may be given to no one.

Here, define condition $X_i$ as "the number of balls given is a multiple of $i$".

The $M$ people are selfish: person $i$ gets angry unless at least $1$ of the conditions $X_{A_{i,1}},X_{A_{i,2}},...,X_{A_{i,k_i}}$ is satisfied. Also, they do not get angry if $1$ or more of the conditions are satisfied.

Find the number of ways to distribute the balls so that no one gets angry, modulo $\boldsymbol{90001}($prime$)$.

Constraints

  • All inputs are integers.
  • $1 \le N \le 10^{200000}$
  • $1 \le M \le 10$
  • $1 \le k_i \le 6$
  • $1 \le A_{i,j} \le 6$

Input

$N\ M$
$k_1\ A_{1,1}\ A_{1,2}\ \dots A_{1,k_1}$
$k_2\ A_{2,1}\ A_{2,2}\ \dots A_{2,k_2}$
$\vdots$
$k_M\ A_{M,1}\ A_{M,2}\ \dots A_{M,k_M}$

Output

Output the answer on $1$ line.

Sample

Sample 1
Input
4 2
1 2
1 1
Output
41

There are $41$ ways to distribute the balls, such as giving balls $2,3$ to person $1$ and ball $4$ to person $2$.

Sample 2
Input
10 3
1 2
1 3
2 2 3
Output
36952

Sample 3
Input
2021 6
1 1
2 2 3
3 4 5 6
1 6
2 4 5
3 1 2 3
Output
83960

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。