#P3947. Activity Reward Challenge
Activity Reward Challenge
Activity Reward Challenge
Yume misinterpreted the event times and now has only a very limited time to play all the songs and reach the reward score threshold. In this challenge, you are given N songs, an event remaining time T, and a required minimum score M. Each song must be played exactly once and playing each song takes exactly 1 unit of time. For the i-th song played (with finishing time i), if the song's "open time" is A and if i ≤ A then the song contributes a score of A - i (otherwise, it gives 0 score). In order to claim the reward, all N songs must be completed within T time units (i.e. N ≤ T) and the sum of the scores must be at least M.
Your task is to determine whether it is possible for Yume to meet the target within the remaining time. If it is possible, output Yes
along with a valid order (a permutation of 1,2,…,N representing the original indices of the songs) in which to play the songs. Otherwise, output No
.
The scoring for each song is given by the formula in LaTeX format:
[ \text{score}_i = \max{0, A_i - i} ]
The total score is then:
[ \text{total score} = \sum_{i=1}^{N} \max{0, A_{\pi(i)} - i} ]
where \(\pi(1), \pi(2), \dots, \pi(N)\) is the chosen order of songs. Note that delaying a song unnecessarily only increases the finishing time and reduces the score for that song, so the optimal strategy is to start immediately and play continuously. It turns out that to maximize the total score, one should schedule songs with higher open times earlier, as this minimizes the finishing time penalty.
inputFormat
The first line contains three integers N, T, and M, where N is the number of songs, T is the remaining available time, and M is the minimum score needed to claim the reward. The second line contains N integers A₁, A₂, …, Aₙ, where Aᵢ denotes the open time limit for the i-th song.
outputFormat
If it is possible for Yume to achieve a total score of at least M by playing all N songs within T time units, output Yes
in the first line and a valid permutation (a sequence of N space-separated integers representing the 1-indexed order of songs to play) in the second line. Otherwise, output a single line containing No
.
sample
2 2 9
1 10
Yes
2 1
</p>