#P4364. [九省联考 2018] IIIDX
[九省联考 2018] IIIDX
Description
Konano received a task to arrange the unlock order of tracks for the in-development game “IIIDX.” There are tracks in total. Each track has a difficulty . The -th track is unlocked after the player clears the -th track ( is the floor function). If , then this track requires no unlock.
For example, when , the -st track requires no unlock (), and the -th track is unlocked after the player clears the -rd track since .
Konano’s job is to arrange the order of these tracks so that each newly unlocked track has a difficulty not lower than the prerequisite track’s difficulty. That is, after determining the order, the difficulties satisfy for every .
Of course, this is easy for Konano, who has spent a lot of time “chilling” in informatics competitions. If it were you, how would you solve this task?
Input Format
The first line contains one positive integer and one real number . is the number of tracks, and is as described above.
The second line contains space-separated positive integers , representing the difficulties of the tracks.
Output Format
Output one line with integers: the difficulty of the -th track after arranging the order.
If there are multiple valid solutions, output the one with maximized; if still tied, maximize ; and so on.
4 2.0
114 514 1919 810
114 810 514 1919
Hint
| Test point ID | Special constraints | |||
|---|---|---|---|---|
| All are distinct | ||||
| None | ||||
| All are distinct | ||||
| None | ||||
| All are distinct | ||||
| None | ||||
| All are distinct | ||||
| None | ||||
Translated by ChatGPT 5
京公网安备 11011102002149号