#C7717. Find the Highest Cumulative Score Level
Find the Highest Cumulative Score Level
Find the Highest Cumulative Score Level
You are given a sequence of levels in a game. At each level, the player gains (or loses) some points. The points at each level are given as an integer that can be positive or negative. As the game progresses, the player's total score is the cumulative sum of the points from level 1 to level n.
Your task is to determine the highest cumulative score achieved during the game and the level (1-indexed) at which this maximum score was first reached. If multiple levels yield the same cumulative maximum score, the earliest level should be returned.
Input/Output Format: The input is received through standard input (stdin) and the output should be printed to standard output (stdout).
Example: For an input of "4\n5 -3 4 3", the cumulative scores are 5, 2, 6, 9. Thus, the highest cumulative score is 9 at level 4.
inputFormat
The first line contains a single integer n representing the number of levels.
The second line contains n space-separated integers indicating the score changes at each level.
Input is provided via standard input (stdin).
outputFormat
Print two integers separated by a space: the highest cumulative score achieved and the level (1-indexed) at which this score was first attained. Output should be written to standard output (stdout).
## sample4
5 -3 4 3
9 4