E. Decryption SOLUTIONS CODEFORCES

Decryption SOLUTION

An operator called Cipher is unscrambling a message, that contains a composite number n. All divisors of n, which are more prominent than 1, are set all around. Code can pick the underlying request of numbers in the circle.
In one move Cipher can pick two neighboring numbers all around and embed their least normal various between them. He can do that move the same number of times varying.
A message is decoded, if each two contiguous numbers are not coprime. Note that for such imperatives it’s consistently conceivable to unscramble the message.
Locate the negligible number of moves that Cipher ought to do to decode the message, and show the underlying request of numbers in the hover for that.
Info
The main line contains a number t (1≤t≤100) — the quantity of experiments. Next t lines depict each experiment.
In a solitary line of each experiment portrayal, there is a solitary composite number n (4≤n≤109) — the number from the message.
It’s ensured that the absolute number of divisors of n for all experiments doesn’t surpass 2⋅105.
Yield
For each experiment in the principal line yield the underlying request of divisors, which are more noteworthy than 1, in the circle. In the subsequent line yield, the insignificant number of moves expected to unscramble the message.
On the off chance that there are various potential requests with a right answer, print any of them.
Model
inputCopy
3
6
4
30
outputCopy
2 3 6
1
2 4
0
2 30 6 3 15 5 10
0
Note
In the principal experiment 6 has three divisors, which are more prominent than 1: 2,3,6. Notwithstanding the underlying request, numbers 2 and 3 are neighboring, so it’s expected to put their least basic different between them. After that the circle gets 2,6,3,6, and each two nearby numbers are not coprime.
In the subsequent experiment 4 has two divisors more noteworthy than 1: 2,4, and they are not coprime, so any underlying request is right, and it’s not expected to put any least basic products.
In the third experiment all divisors of 30 more prominent than 1 can be put in some request so that there are no two adjoining numbers that are coprime.

Leave a Comment

close
error: Content is protected !!