| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 5 | 5 | 2 | 100.000% |
You are currently studying a tree traversal algorithm called the Depth First Search (DFS). Suppose you have a rooted tree of $n$ nodes (numbered from 1ドル$ to $n$) with a depth of $K$ (numbered from 1ドル$ to $K$). The root (the node at depth 1ドル$) is located at node 1ドル$. All leaves are located at the same depth, that is, at depth $K$. Node $i$ has an array of children nodes $c_i,ドル which could be empty if $i$ is a leaf node. The pseudocode of the algorithm is presented as follows.
DFS(u, depth): let res be an empty array append depth to res for each v in c[u]: let D be an array initialized with DFS(v, depth + 1) for each x in D: append x to res return res
Consider the trees in the following illustration. The return values of DFS(1, 1) for the tree on the left and the tree on the right are $[1, 2, 3, 3, 3]$ and $[1, 2, 3, 2, 3],ドル respectively.
Denote $f_K(n)$ as the number of distinct return values of DFS(1, 1) across all trees consisting of $n$ nodes and all leaves are located in depth $K$. You are given $M$ integers: $A_1, A_2, \dots , A_M$. Determine the value of $f_K(A_1) \times f_K(A_2) \times \cdots \times f_K(A_M)$. As the answer can be very large, find the answer modulo 998ドル,円 244,円 353$.
The first line consists of two integers $K$ $M$ (1ドル ≤ K, M ≤ 100,円 000$).
The following line consists of $M$ integers $A_i$ ($K ≤ A_i ≤ 200,円 000$).
Output a single integer representing the value of $f_K(A_1) \times f_K(A_2) \times \cdots \times f_K(A_M)$ modulo 998ドル,円 244,円 353$.
3 2 5 6
6
The value of $f_3(5)$ and $f_3(6)$ are 2ドル$ and 3ドル,ドル respectively. The illustration on the description shows the trees of 5ドル$ nodes that give distinct return values of DFS(1, 1). The following illustration is for the trees of 6ドル$ nodes.
100000 1 200000
269130693
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2024 I번