#P15655. [ICPC 2025 Jakarta R] Nihilation
[ICPC 2025 Jakarta R] Nihilation
题目描述
You are given an array consisting of positive integers.
In one operation, you can choose integers and such that and set for .
What is the minimum number of operations needed to make all equal to ?
Output any sequence of operations to be done. It can be proven that it is always possible to make all equal to .
输入格式
Input begins with an integer (). The next line contains integers () representing the given array .
输出格式
In the first line, output the minimum number of operations needed.
In the next lines, output two integers and , representing the operation in the sequence of operations that makes all equal to .
If there are multiple such sequences, output any one of them.
5
4 1 2 6 3
2
12 6
3 2
2
9 9
1
3 1
提示
The following describes the sequence of operations done in the sample output.
- $A_i := (A_i \times 6) \bmod 12 \implies A = [0, 6, 0, 0, 6]$
- $A_i := (A_i \times 2) \bmod 3 \implies A = [0, 0, 0, 0, 0]$
It can be shown that no sequence of operations with length can make all equal to .