[Solution] Ela and Prime GCD Codeforces Solution
. Suppose that has divisors. You have to find a sequence with integers , which satisfies the following conditions:
- Each element is strictly greater than .
- Each element is a divisor of .
- All elements are distinct.
- For all , is a prime number.
In this problem, because can be too big, the result of prime factorization of is given instead. Note that denotes the greatest common divisor (GCD) of integers and and a prime number is a positive integer which has exactly divisors.
The first line contains one integer () - the number of test cases.
The first line of each test case contains one integer () - the number of prime factor of .
The second line of each test case contains integers () — exponents of corresponding prime factors of , so that and hold. is the -th smallest prime number.
It is guaranteed that the sum of over all test cases does not exceed .
Print the answer for each test case, one per line. If there is no sequence for the given , print .
Otherwise, print lines. In -th line, print space-separated integers. The -th integer of -th line is equal to the exponent of -th prime number from .
If there are multiple answers, print any of them.
No comments:
Post a Comment