子序列(seq.cpp)
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Background
Special for beginners, ^_^
Description
小 C 非常喜欢数字。 这次,他得到了一个长度为 n 的正整数数列 A,第 i 项为 ai。现在,小 C 想要找出来 A 中最长的子序列B = {b1, b2, ...... , bm},使得对于任意的二元组 (i, j),bi 和 bj 满足倍数关系。小 C 突然不会最长不下降子序列了,于是找到了你来帮他求出最长的子序列的长度。
子序列:对于长度为 n 的数列 A,对于 B ={b1, b2, ...... , bm},若 b1= ap1 , b2=ap2, ......, bm= apm,则必须要满足 1 ≤ p1< p2 < ...... < pm≤ n,这样的数列 B 称为 A 的子序列。其中子序列B可以为空。
Format
Input
共两行,第一行有一个正整数 n,表示数列 A 的长度; 第二行有 n 个正整数,第 i 个数表示 ai。
Output
仅一行一个数,表示子序列长度的最大值。
Samples
5
1 2 3 8 16
4
10
1 4 6 3 9 11 16 24 42 36
4
Limitation
提示︰本题输入规模较大,请避免使用过慢的输入方式。并尽量减少使用STL,以降低程序本身带来的常数。
2023CPS-J 测试2
- Status
- Done
- Rule
- IOI
- Problem
- 4
- Start at
- 2023-10-4 14:00
- End at
- 2023-10-8 18:00
- Duration
- 100 hour(s)
- Host
- Partic.
- 12