PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000100. Nikita và BCNN (Nikita and LCM)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Nikita và BCNN (Nikita and LCM)
Nikita and LCM
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given an array of positive integers, choose any subsequence by deleting elements while preserving order. A subsequence is special if the least common multiple of its elements is not present in the original array . By convention, the LCM of the empty subsequence is . Find the maximum possible length of a special subsequence.
Input
The first line contains . The second line contains positive integers .
Output
Print the maximum length of a special subsequence.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
6
3 2 10 20 60 1
Output
4
Explanation
Choose the original-order subsequence , with LCM , which is absent from the original array. Its length is , and no special subsequence of length exists.