Back From Summer '19 P6: Composite Zeyu

View as PDF

Submit solution


Points: 15 (partial)
Time limit: 0.75s
Memory limit: 128M

Authors:
Problem types

Zealous Zeyu is looking for a brand new set of arms today!

There are N arms currently on sale. The ith arm has a length of ai zeyumeters from end to end. For legal and aesthetic reasons, the store refuses to sell you two of the same arm (i.e. two of arm i).

Zeyu is looking to replace k of his arms. He prefers sets of arms where the product of its arm lengths contains the minimal number of unique prime factors. He likes to be as prime as possible 😎.

What is the minimal number of unique prime factors of such a set? Zeyu needs to know this in order to make the best possible purchase.

Input Specification

The first line will contain one integer, N (1N105).

The second line will contain N integers, ai (2ai109), the lengths of the arms.

Read carefully: It is guaranteed that ai's prime factors will have a value of less than or equal to 75. In other words, if ai=b1m1×b2m2××bkmk where bj is a unique prime, then 2bj75.

Output Specification

Output N space separated integers, the kth (1kN) integer representing the minimum number of unique prime factors for the product of k arm lengths in a set.

Constraints

Subtask 1 [5%]

N15

Subtask 2 [25%]

N100

Subtask 3 [70%]

No additional constraints.

Sample Input 1

Copy
4
2 20 10 15

Sample Output 1

Copy
1 2 2 3

Sample Input 2

Copy
3
7 153 10

Sample Output 2

Copy
1 3 5

Comments

There are no comments at the moment.