QOJ.ac

QOJ

حد الوقت: 3 s حد الذاكرة: 256 MB مجموع النقاط: 100

#4264. Prodacot

الإحصائيات

Let $N = \prod_{i = 1}^{n} p_i^{a_i}$ and $M = \prod_{i = 1}^{n} p_i^{b_i}$, where $p_i$ are distinct prime numbers.

Find the number of ways to represent $N$ as a product of $k$ positive integers, i.e., the number of solutions to $N = \prod_{i = 1}^k x_i$. The answer should be taken modulo $10^9 + 21$.

For subproblem 1, it is required that for all integers $i$ such that $1 \leq i < k$, $x_i < x_{i + 1}$.

For subproblem 2, it is required that for all integers $i$ such that $1 \leq i < k$, $x_i \leq x_{i + 1}$.

For both subproblems, it is required that for all integers $i$ such that $1 \leq i \leq k$, $x_i \nmid M$, meaning $x_i$ is not a divisor of $M$.

Input

The first line contains two positive integers $n, k$.

The next line contains $n$ non-negative integers, where the $i$-th integer represents $a_i$.

The next line contains $n$ non-negative integers, where the $i$-th integer represents $b_i$.

The primes $p_1, \dots, p_n$ are not provided in the input; clearly, the values of $p_i$ do not affect the answer.

Output

One line containing two integers, representing the answers to subproblem 1 and subproblem 2, respectively.

Examples

Input 1

5 3
5 5 4 5 5
3 0 3 2 3

Output 1

295164 295326

Input 2

10 5
13 11 17 7 9 2 11 11 10 12
7 9 4 15 18 4 9 7 4 2

Output 2

75340090 59089865

Subtasks

There are 10 test cases. Correctly solving only subproblem 1 earns 3 points, only subproblem 2 earns 6 points, and solving both earns 10 points.

Test Case ID $n$ $a_i$ $b_i$ $k$
1$\leq 5$$\leq 5$$\leq 5$$\leq 3$
2$\leq 10$$\leq 20$$\leq 20$$\leq 5$
3$= 1$$\leq 10^{18}$$\leq 10^{18}$$\leq 25$
4$\leq 50$$\leq 10^3$$= 0$$\leq 20$
5$\leq 10^{18}$$\leq 25$
6$\leq 10^3$$\leq 10^3$$\leq 10$
7$\leq 10^{18}$$\leq 10^{18}$$\leq 10$
8$\leq 15$
9$\leq 20$
10$\leq 25$

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.