Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Remember the Future

By maruf_0011 · Limits 2s, 512 MB

You are an alien living in the future. You can move through one time dimension to another time dimension. This time travel is controlled by a Time Travel Company (TTC).

But there is a problem while moving from one dimension to another dimension. Every time you move, TTC will give you an integer number and charge you money equal to the absolute value of the given number.

Now, given all of the integer values that TTC gave you during your journey, find the maximum amount of money you had to spend for a single move during your travel.


First line of the input contains an integer T (1 ≤ T ≤ 1000) which is the number of test case.

For every test case first line contains an integer N (0 ≤ N ≤ 1000), the number of moves you made and next line contains N integers value which are given while you move.

Absolute value of all the given numbers are less than 1000.


Print with format "Case x: y" where x is the case number and y is the max amount you paid on your way.


-1 1
-4 0 10
-10 2 1 7 5
Case 1: 1
Case 2: 10
Case 3: 10



81% Solution Ratio

sakibalaminEarliest, Apr '18

identityFastest, 0.0s

sakibalaminLightest, 262 kB

Index0Shortest, 211B


Login to submit

Related Contests

Toph uses cookies. By continuing you agree to our Cookie Policy.