Sphere Online Judge

SPOJ Problem Set (classical)

11373. Coke madness

Problem code: RPLC


David likes coke, lets say he likes it a lot... One day he was walking by a narrow street when he sees a lot of bottles of cokes, from different brands, he wants to drink it all, but he noticed that one brand gives him power, the other brand weaken him, now, he can wait and regain more energy, but he don't want to do that, he will wait at the beginning and, when he has the sufficient energy he will drink all the cokes in the street.


Please, help him find when he will be in the perfect moment to drink all the cokes.

 

INPUT:

Will start with an integer T denoting the number of test cases, then, T lines will follow, for each test case, there will be an integer N, then, in the next line will be N integers, this will be the number of cokes, and the values of the cokes in the floor (the positive one gives energy, the negative ones will take his energy).

 

OUTPUT:

Each test case will output the string “Scenario #i: “ where i is the number of test case analyzed, followed by the minimum energy required by David to pass the street.

 

INPUT

OUTPUT

2

5

4 -10 4 4 4

 

5

1 2 3 4 5

Scenario #1: 7

Scenario #2: 1


Blank line between test cases for clarification and separation”

The life of David should never reach 0 or less”

 

CONSTRAINTS:

1<=N<=1000000

-10000000<=Ni<=10000000


Added by:David Moran
Date:2012-04-12
Time limit:1s
Source limit:50000B
Memory limit:256MB
Cluster: Pyramid (Intel Pentium III 733 MHz)
Languages:All
Resource:Own Problem used for the RPL contest

hide comments
2014-06-25 19:40:30 sobriquet
Cakewalk
2014-06-15 01:25:44 Sudarshan K
Easy and few lines of code :)
2014-06-04 18:36:14 sharad mahajan
for summing use long long int
2014-05-15 16:00:37 MJ
tricky one-
i/p:
1
10
2 -4 1 1 1 -1 -1 0 0 -15
o/p
17
2014-04-30 11:49:49 SHIVAM DIXIT


Last edit: 2014-04-30 11:58:03
2014-04-24 07:06:42 Amarveer Singh
there is no need to use blank lines.
AC without using blank lines.
I/O format is normal
2014-02-20 12:55:28 free mind ;)
there is a space after ":" :)
2014-02-10 17:37:11 Aravindan Chandrasekaran
Explain why I am getting WA ?
2013-12-20 12:47:32 Hitman
If u r summing then consider long long int
caused me 1 WA
2013-10-26 20:08:32 Sakthivel
finally got AC in 0.11 sec after many wrong answers...!

Last edit: 2013-10-26 20:08:54
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.