All submissions for this problem are available.
Jitendra has won a lottery of K rupees. He wants to utilize this money optimally.
He wants to travel different cities in consecutive order with help of money he won in lottery.For travelling every city, he has to pay some amount. He wants to travel as many number of cities he can travel with the available lottery money.
Help Jitendra to find the maximum number of cities he can travel and the remaining money.
The first line of the input contains an integer T denoting the number of test cases. The description of T
test cases follows.
The first line of each test case contains two space-separated integers N and K, denoting the number of cities and the lottery money respectively. The second line of each test case contains N space-separated integers denoting the cost of travelling the ith city.
For each test case on new line, print two space separated integers: the maximum number of city he can visit and the unused(or remaining) money.
1 <= T <= 10 1 <= N <= 100000 1 <= K <= 1000000000 1 <= a[i] <= 1000000000 , for each valid i
1 5 5 3 5 2 1 7
He can travel maximum of 2 cities and cost of visiting them is 2+1.Hence, the remaining money is 5-3=2.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions