The Best-So-Far Score
The arcade cabinet at Fenwick College shows a player's personal best on screen throughout a session, updating it the moment it is beaten and leaving it alone otherwise. After the session the machine prints what that display said after every attempt, so a player can see when the improvements came. The attempts are listed in the order they were played, and a bad attempt never lowers a personal best that has already been set.
Task: Print what the personal-best display read after each attempt.
Input
The first line holds a single integer n, the number of attempts. Each of the next n lines holds one attempt's score, which may carry decimals.
Output
One line holding n figures, in attempt order, separated by single spaces. Write each as a whole number. The first figure is always the first attempt's own score.
Example:
Input:
5
10
25
15
30
20
Output:
10 25 25 30 30
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in