| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 36 | 20 | 18 | 52.941% |
You are given an array $A = [A_1, A_2, \ldots, A_N]$ consisting of $N$ positive integers.
In one operation, you can choose integers $m$ and $k$ such that $1 \leq k < m \leq 10^9$ and set $A_i := (A_i \times k) \bmod m$ for $1 \leq i \leq N$.
What is the minimum number of operations needed to make all $A_i$ equal to $0$? Output any sequence of operations to be done. It can be proven that it is always possible to make all $A_i$ equal to $0$.
Input begins with an integer $N$ ($1 \le N \le 100\,000$). The next line contains $N$ integers $A_i$ ($1 \le A_i \le 10^9$) representing the given array $A$.
In the first line, output the minimum number $q$ of operations needed.
In the next $q$ lines, output two integers $m$ and $k$, representing the operation in the sequence of operations that makes all $A_i$ equal to $0$. If there are multiple such sequences, output any one of them.
5 4 1 2 6 3
2 12 6 3 2
Explanation of Sample 1: The following describes the sequence of operations done in the sample output.
It can be shown that no sequence of operations with length $1$ can make all $A_i$ equal to $0$.
2 9 9
1 3 1