#GL0000191. Khôi phục dãy đã trộn (Recover it!)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Khôi phục dãy đã trộn (Recover it!)
Khôi phục dãy đã trộn (Recover it!)
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A hidden array has integers greater than . For each original , append one new integer: if is prime, append the -th prime number in the ordered sequence ; otherwise append the largest proper positive divisor of . Shuffle all resulting values into array . Recover any valid original array . A solution is guaranteed to exist; the order of your output array is arbitrary.
Input
First line: . Second line: exactly integers of array .
Output
Print exactly integers that could produce the given multiset . Any valid answer is accepted.
Subtasks
-
Subtask 1 (20 points): ; ; .
-
Subtask 2 (30 points): ; ; .
-
Subtask 3 (50 points): ; ; .
Examples
Example 1
Input
3
3 5 2 3 2 4
Output
3 4 2
Explanation
The original array appends respectively the third prime , the greatest proper divisor of , and the second prime . The resulting multiset is exactly the input.
Example 2
Input
1
2750131 199999
Output
199999
Explanation
The prime is accompanied by the -th prime, which equals .
Example 3
Input
1
3 6
Output
6
Explanation
The greatest proper positive divisor of composite is , hence the original array may be .