luogu#P9928. [NFLSPC #6] 来点不那么魔怔的题面
[NFLSPC #6] 来点不那么魔怔的题面
Problem Description
Given a permutation of and an integer , you need to find a subsequence of () such that:
- There are exactly integers satisfying and is the -th smallest among .
If there are multiple solutions, output any one of them. If there is no valid subsequence, output .
Input Format
The first line contains two integers .
The next line contains integers , representing the given permutation.
Output Format
If there is no solution, output one line with the integer .
Otherwise, output an integer in the first line, the length of the subsequence. You must ensure .
In the next line, output integers , the indices of the subsequence. You must ensure and ().
4 1
4 2 1 3
3
2 3 4
Hint
For all testdata, , , and is a permutation of .
- Subtask 1 ( points): .
- Subtask 2 ( points): .
- Subtask 3 ( points): .
- Subtask 4 ( points): .
- Subtask 5 ( points): no special constraints.
Source: NFLSPC #6 D by tzc_wk
Translated by ChatGPT 5