#abc354f. F - Useless for LIS
F - Useless for LIS
Score : points
问题陈述
给定一个长度为 的整数序列 。
对于每个 ,确定 是否包含在 的最长递增子序列中。
这里, 包含在 的最长递增子序列中当且仅当满足以下条件:
-
设 为 的最长递增子序列的长度。存在一个严格递增的整数序列 $i = (i_1, i_2, \dots, i_L) \ (i_1 < i_2 < \dots < i_L)$,其中每个元素都在 和 之间(包括 和 ),满足以下所有条件:
- 。
- 对于某个 ,有 。
你将得到 个测试用例;解决每一个。
什么是最长递增子序列?
一个序列 的子序列是通过从 中提取一些元素而不改变顺序得到的序列。
一个序列 的最长递增子序列是严格递增且长度最大的子序列。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given an integer sequence of length .
For each , determine whether is included in a longest increasing subsequence of .
Here, is included in a longest increasing subsequence of if and only if the following holds:
-
Let be the length of a longest increasing subsequence of . There exists a strictly increasing integer sequence $i = (i_1, i_2, \dots, i_L) \ (i_1 < i_2 < \dots < i_L)$, where each element is between and , inclusive, that satisfies all of the following conditions:
- .
- for some .
You are given test cases; solve each of them.
What is a longest increasing subsequence?
A subsequence of a sequence is a sequence that can be derived by extracting some elements from without changing the order.
A longest increasing subsequence of a sequence is a subsequence of that is strictly increasing with the greatest possible length.
Constraints
- The sum of across all test cases is at most .
Input
The input is given from Standard Input in the following format:
Here, represents the input for the -th case. Each case is given in the following format:
Output
Print the answers in the following format:
Here, represents the output for the -th case. For each case, let there be indices such that is included in a longest increasing subsequence of , which are in ascending order. Print these in the following format:
Sample Input 1
1
5
2 1 4 5 3
Sample Output 1
4
1 2 3 4
One of the longest increasing subsequences is , with a length of . Another longest increasing subsequence is . However, no longest increasing subsequence includes .
Therefore, print .
Sample Input 2
2
6
2 5 3 4 3 4
5
10000 1000 100 1 10
Sample Output 2
5
1 3 4 5 6
2
4 5
相关
在下列比赛中: