Not the Longest Increasing Subsequence
Time limit2sMemory limit512 MB
Given an array of n integers from 1 to k, find the fewest elements to delete so that its longest increasing subsequence has length less than k, and list their indices.
- Level
Hard8 of 10
- Topics
- Dynamic programming, Greedy, Array
- Solved
- No attempts yet
Problem
You have an array of integers. Each element is between and . What is the smallest number of elements that must be removed from the array so that its longest increasing subsequence has length less than ?
Input
The first line contains two integers and (, ), the length of the array and the upper bound for its elements. The second line contains integers (), the elements of the array.
Output
In the first line, output an integer , the number of elements to remove. In the second line, output integers, the indices of the removed elements. The indices are numbered from to .