logo AlgoBeat OnlineJudge
登录 注册

#215419. [MCO 2025] Subsequence

内存限制:256 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Given an array and an integer , you are tasked to find the longest subsequence of the array . A subsequence is if and only if none of the products of neighbouring elements in the subsequence exceed . That is, suppose is the subsequence of with length , is if and only if for any , where , .

Note: An array is a subsequence of another array if can be created by removing some elements (possibly none) from array without changing the order of elements. For example, the array is a subsequence of , whereas the array and the array is \textbf{not} a subsequence of .

输入格式

The first line contains two space-seperated integers, () and () -- is the length of array and is the integer given.

The second line contains space-seperated integers, ().

输出格式

The only line contains an integer, which is the length of the longest subsequence.

样例

样例输入 1

1 10
100

样例输出 1

1

样例输入 2

5 10
3 4 2 5 1

样例输出 2

4

样例输入 3

5 10
6 -2 -2 -6 5

样例输出 3

4

数据范围与提示

Note

A subsequence of one element is always valid because there are no neighbouring elements. Therefore, the length of the longest subsequence is .

This example has a subsequence, . It is because the product of the neighbouring elements does not exceed , as shown below.

The subsequence (i.e., the original array ) is because the product of the first and second elements is 12, which exceeds .

Therefore, the length of the longest subsequence is .

The longest subsequence is .

The subsequence (i.e., the original array ) is because the product of the third and fourth elements is , which exceeds .

Scoring

Subtask 1 ( points):

Subtask 2 ( points):

Subtask 3 ( points):

Subtask 4 ( points): and , for all

Subtask 5 ( points): and , for all

Subtask 6 ( points): and , for all

Subtask 7 ( points): No additional constraints