Score : $400$ points
Given is a number sequence $A_1, A_2, A_3, \dots, A_N$, which may contain negative elements.
On a number line, there is a robot at coordinate $0$. It will do the following actions in order:
$\hspace{140pt} \vdots$
Find the greatest coordinate occupied by the robot from the beginning to the end of the process.
Input is given from Standard Input in the following format:
$N$ $A_1 \hspace{7pt} A_2 \hspace{7pt} A_3 \hspace{5pt} \dots \hspace{5pt} A_N$
Print the greatest coordinate occupied by the robot from the beginning to the end of the process.
3 2 -1 -2
5
The robot moves as follows:
The greatest coordinate occupied during the process is $5$, so we should print $5$.
5 -2 1 3 -1 -1
2
5 -1000 -1000 -1000 -1000 -1000
0
In this case, the initial coordinate $0$ is the greatest coordinate occupied.