RPLC  Coke madness
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
hide comments
dokz:
20160120 07:23:38
Had a runtime error twice, removed Console.ReadLine() after a test case, AC. It looks like there are actually no blank lines between test cases. In general, it is an interesting problem, but with awful description and input: "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". Absolutely wrong and unclear. Last edit: 20160120 07:24:31 

jarvis:
20150922 21:00:14
cin/cout inplace of printf/scanf be careful with $#: space $


Shivam Singh:
20150819 13:43:29
If you are calculating the total energy at every step, it will cross the int limit... 

Babu:
20150804 17:48:22
Be careful with spaces in the output.These things mean nothing but costed 2 WA _ 

Varun Gambhir:
20150720 22:00:22
Use long long if using C/C++ 

artista_14:
20150621 15:49:40
Easy if got the logic...50th AC..:) 

Rishabh Joshi:
20150527 14:59:53
c gets WA c++ AC. Problem in the spaces in input and output, so scanfprintf after being replaced by cin cout worked. 

TUSHAR SINGHAL:
20150401 07:57:56
space between scenario #$: $ and answer costed me 1 wa ....be careful :)


Pratik Ritesh:
20150305 19:06:44
range of test cases t?? 

david_8k:
20120628 16:52:33
People

Added by:  david_8k 
Date:  20120412 
Time limit:  0.180s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 
Resource:  Own Problem used for the RPL contest 