| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 2048 MB | 4 | 3 | 3 | 75.000% |
A square field has been divided into $N^2$ rectangular plots by drawing $(N-1)$ vertical and $(N-1)$ horizontal lines. The rows of plots are numbered $1 \ldots N$ from bottom to top and the columns $1 \ldots N$ from left to right, as shown on the figures below (the figures are not to scale).
The plots located at the intersection of the $i$-th column and the $i$-th row (for $1 \le i \le N$) are called the long diagonal. The plots located at the intersection of the $(i+1)$-st column and the $i$-th row (for $1 \le i \le N-1$) are called the short diagonal.
You know the areas of the plots on the long and short diagonals. Calculate the area of the plot at the intersection of the $X$-th column and the $Y$-th row.
The first line contains the integer $N$ ($2 \le N \le 1\,000$).
The second line contains $N$ integers $A_1, A_2, \dots, A_N$ ($1 \le A_i \le 10^9$) --- the areas of the plots on the long diagonal.
The third line contains $N-1$ integers $B_1, B_2, \dots, B_{N-1}$ ($1 \le B_i \le 10^9$) --- the areas of the plots on the short diagonal.
The fourth line contains two integers $X$ and $Y$ ($1 \le X, Y \le N$) --- the coordinates of the plot whose area should be calculated.
Output the area $S$ of the plot located at the intersection of the $X$-th column and the $Y$-th row. The answer should be represented as a sequence of lines, each containing two integers $P_i$ and $S_i$. The numbers $P_i$ must be distinct primes. The numbers $S_i$ must be non-zero integers such that $$ S = P_1^{S_1} \cdot P_2^{S_2} \cdot P_3^{S_3} \cdot \ldots \cdot P_k^{S_k}, $$ where $k$ is the number of lines in the answer. The lines must be listed in increasing order of $P_i$. (Recall that an integer $P$ is considered prime if it has exactly two positive integer divisors: $1$ and $P$.)
If $S = 1$, then output it as a single line "1 1".
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 5 | Each known area is either $1$ or a prime less than $100$; $X = Y$ or $X = Y + 1$. |
| 2 | 5 | Each known area is either $1$ or a prime less than $100$; $X = Y - 1$. |
| 3 | 5 | Each known area is at most $10\,000$; $X = Y$ or $X = Y + 1$. |
| 4 | 5 | $X = Y$ or $X = Y + 1$. |
| 5 | 5 | Each known area is at most $10\,000$; $X = Y - 1$. |
| 6 | 5 | $X = Y - 1$. |
| 7 | 5 | $N = 5$; each known area is at most $100$. |
| 8 | 5 | Each known area is either $1$ or a prime less than $100$; $X = 1$ and $Y = N$. |
| 9 | 5 | Each known area is either $1$ or a prime less than $100$; $X = N$ and $Y = 1$. |
| 10 | 5 | Each known area is either $1$ or a prime less than $100$; $X < Y$. |
| 11 | 5 | Each known area is either $1$ or a prime less than $100$; $X > Y$. |
| 12 | 5 | Each known area is at most $100$; $X = 1$ and $Y = N$. |
| 13 | 5 | Each known area is at most $100$; $X = N$ and $Y = 1$. |
| 14 | 5 | Each known area is at most $100$; $X < Y$. |
| 15 | 5 | Each known area is at most $100$; $X > Y$. |
| 16 | 5 | $X = 1$ and $Y = N$. |
| 17 | 5 | $X = N$ and $Y = 1$. |
| 18 | 8 | $X < Y$. |
| 19 | 7 | $X > Y$. |
5 6 1 3 9 5 3 9 3 6 2 3
3 -1
This example corresponds to the left figure above. The area of the plot at the intersection of the 2-nd column and the 3-rd row is $$ S = \frac{1}{3} = 3^{-1}. $$
5 5 2 8 3 5 2 6 8 9 5 2
2 1 3 2
This example corresponds to the right figure above. The area of the plot at the intersection of the 5-th column and the 2-nd row is $$ S = 18 = 2^{1} \cdot 3^2. $$
5 6 1 3 9 5 3 9 3 6 2 4
1 1