#C13836. Longest Increasing Subsequence with Non-Numerical Filtering

    ID: 43418 Type: Default 1000ms 256MiB

Longest Increasing Subsequence with Non-Numerical Filtering

Longest Increasing Subsequence with Non-Numerical Filtering

Given an array of elements, compute the length of the longest increasing subsequence (LIS) considering only the numerical values. Non-numerical entries will be ignored. Formally, if (A) is the original array and (A') is the subsequence containing only the numeric elements, you are to compute (\text{LIS}(A')), where the longest increasing subsequence is defined as the longest sequence ({a_{i_1}, a_{i_2}, \ldots, a_{i_k}}) such that (a_{i_1} < a_{i_2} < \cdots < a_{i_k}). The input is read from standard input (stdin) and the result should be printed to standard output (stdout).

inputFormat

The input is given via standard input (stdin). The first line contains an integer (n), representing the number of elements in the array. The second line contains (n) space-separated tokens. Each token might represent an integer, a floating-point number, or a non-numerical string. Only tokens that can be successfully parsed as numbers are considered in the computation.

outputFormat

Output a single integer to standard output (stdout), which is the length of the longest increasing subsequence among the numeric values extracted from the input.## sample

0
0