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.
Example
Input: 2 5 4 -10 4 4 4 5 1 2 3 4 5 Output: Scenario #1: 7 Scenario #2: 1
“The life of David should never reach 0 or less”
Constraints
1 ≤ N ≤ 1000000
-10000000 ≤ Ni ≤ 10000000
hide comments
sriraj:
2016-10-14 00:37:12
Test case
|
|
madhavgaba:
2016-09-12 21:08:58
use long long......costed me 1WA:( |
|
mkfeuhrer:
2016-07-13 16:27:15
silly WA due to printing !! take care of printing rest easy! |
|
pranjalikumar9:
2016-06-06 22:57:53
long long int guys..long long int..sigh
|
|
aru_674:
2016-06-06 17:27:55
why is it giving WA with printf/scanf and AC with cin/cout? please explain |
|
gkr007:
2016-06-04 19:46:18
My 50th..should go to tutorials though.. :)..take care of the "Scenario" while printing the answer.. Last edit: 2016-06-04 19:47:11 |
|
hvar:
2016-06-03 12:16:14
same logic accepted in c but not in c++ even after using scanf/printf inplace of cin/cout something is wrong with c++ compiler of this problem
|
|
sanjay:
2016-05-28 17:34:08
NEAT AND GOOD AD-HOC. THANKS TO THE AUTHOR. :) |
|
papan_97:
2016-04-20 17:42:17
AC in one go...my 25th :D :)
|
|
prateek1985:
2016-04-09 16:12:55
easy one but poorly framed.. |
Added by: | david_8k |
Date: | 2012-04-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own Problem used for the RPL contest |