PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000110. MEX của các ƯCLN (GCD MEX)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
MEX của các ƯCLN (GCD MEX)
GCD MEX
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given , construct an array of length , with . Form the set of GCDs of all distinct pairs of positions. The positive MEX (smallest missing positive integer, equal to for an empty set) must be at least .
Input
One line containing .
Output
Print on the first line, followed by array elements. For , print no elements.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
3
Output
3
1 2 4
Explanation
The pairwise GCDs are , hence and its positive MEX equals .