PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000111. Khôi phục bảng ƯCLN (GCD Table)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Khôi phục bảng ƯCLN (GCD Table)
GCD Table
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
An array of positive integers generates an table with entry . You are given all table entries in arbitrary order. Reconstruct any array whose GCD table has exactly that multiset of values. A valid array is guaranteed to exist.
Input
The first line contains . The next line contains exactly positive table entries.
Output
Print positive integers of a valid reconstructed array.
Subtasks
- Subtask 1 (20 points): , .
- Subtask 2 (30 points): , .
- Subtask 3 (50 points): , .
Examples
Input
2
1 1 1 1
Output
1 1
Explanation
The array generates a table with all four entries equal to .