#K36647. Plant Growth Ranking
Plant Growth Ranking
Plant Growth Ranking
This problem involves determining the ranking of plants based on their projected final heights after a given number of days. Each plant grows at a constant rate per day. The final height of a plant is computed as:
\( \text{height}_i = \text{growth\_rate}_i \times D \)
After computing the final heights, the plants are sorted in descending order. The plant with the highest final height earns rank 1, the second highest earns rank 2, and so on. If two plants have the same final height, the order in which they appear in the input is preserved in the ranking.
Your task is to read the number of plants, the number of days, and the growth rates of the plants, and then output the rank of each plant in their original order.
inputFormat
The first line contains two integers \(N\) and \(D\), where \(N\) is the number of plants and \(D\) is the number of days. The second line contains \(N\) space-separated integers, where the \(i\)th integer represents the daily growth rate of the \(i\)th plant.
outputFormat
Output a single line containing \(N\) space-separated integers. The \(i\)th integer should be the rank of the \(i\)th plant based on their final heights after \(D\) days. The plant with the highest final height receives rank 1.
## sample6 3
10 15 20 25 30 5
5 4 3 2 1 6
</p>