- 20, Oct 2024
- #1
А монотонная подпоследовательность — это последовательность чисел \$a_1, a_2, ..., a_n\$ такая, что
$$a_1 \le a_2 \le ... \le a_n \\
[1, 3, 7, 5, 4, 2] -> [[1, 3, 7], [5, 4, 2]] -> 2
[1, 2, 3, 4, 5, 6] -> [1, 2, 3, 4, 5, 6] -> 1
[3, 1, 5, 5, 6] -> [[3, 1], [5, 5, 6]] -> 2
[4, 6, 8, 9, 1, 6] -> [[4, 6, 8, 9], [1, 6]] -> 2
[3, 3, 3, 3] -> [[3, 3, 3, 3]] -> 1
[7] -> [[7]] -> 1
[] -> [] -> anything (you don't actually have to handle an empty list case)
[1, 3, 2, -1, 6, 9, 10, 2, 1, -12] -> [[1, 3], [2, -1], [6, 9, 10], [2, 1, -12]] -> 4
is a monotonic (non-decreasing) subsequence, as well as N
\text{или} \\ N
is not. Given a list of integers (in any reasonable format), output the smallest number [1, 3, 6, 9, 8]
a_1 \ge a_2 \ge ... \ge a_n$$ [9, 4, 4, 3, 0, -10, -12]
monotonic sequences.
(этот показатель не возрастает), но
[1, 3, 3, 7, 9, 13, 13, 100]
такие, что последовательность этих целых чисел можно разбить на