#P9064. [yLOI2023] 苦竹林
[yLOI2023] 苦竹林
Background
The wind chimes hanging under the eaves sound pleasant as they sway.
Longing is like the endless plum rain, leaving my mood a muddy mess.
The scattered stars across the sky sparkle with the fate we share.
When maple leaves lightly fall into the heart of the lake, the nearby view is calm and peaceful.
— Yin Lin & Han Yu, Bitter Bamboo Grove
Problem Description
There are wind chimes hanging under the eaves, and each wind chime can produce a sound of a certain pitch. Number the wind chimes from left to right from to . The pitch of the -th wind chime is .
To express his longing, Fusu decides to take out of the wind chimes and give them to a friend far away.
Please find the minimum integer such that there exists a way to choose wind chimes from the wind chimes. Let the pitches of the selected wind chimes be . They must satisfy that for any , we have .
Input Format
The first line contains two integers, representing the number of wind chimes and the number of wind chimes to select .
The second line contains integers, representing the pitch of each wind chime. The -th integer is .
Output Format
Output one integer on a single line, representing the minimum .
5 3
1 2 3 4 5
2
6 4
1 7 8 3 4 6
4
Hint
Explanation for Sample 2
One possible plan is to choose the -th wind chimes, with pitches in order. Then for any , we have .
Another plan is to choose the -th wind chimes. The computed is also .
Constraints
- For of the testdata, .
- For another of the testdata, .
- For of the testdata, .
- For of the testdata, it is guaranteed that for all , , i.e., is non-decreasing.
- For of the testdata, .
- For of the testdata, , and .
Notes
This problem provides three additional sample files. See ring.zip in the attachments.
Translated by ChatGPT 5