Knockout Jump

All submissions for this problem are available.
One fine day, https://codechef.com/users/yusufi123 ">Yusuf and https://www.codechef.com/users/amitrajit_bose "> Jeet were together playing a game, called $Knockout Jump$. Chef is watching this game and wants to join in as a referee. The game goes like this, Chef gives a positive integer $K$ and an array of positive integer values $A_1, A_2, ...., A_N$ to both Yusuf and Jeet. Then they need to move from $0$^{$th$} position to $(N+1)$^{$th$} position by jumping through the array, one by one. That is, first Yusuf move from $0$^{$th$} position to $(N+1)$^{$th$} position then Jeet. The rules of the game are goes like this,  Initially both the players have $0$ score.  If a player is in $i$^{$th$} position, he can jump at any position in range $[(i+1), min((i+K), (N+1))]$ inclusive.  Each time a player lands on a position, the value of that position of the array is added to its score.  They both do the same thing one by one.  At the end, when they both reach to the $(N+1)$^{$th$} position, the player with the minimum score, wins the game and the other one gets knockout. You are playing instead of Yusuf as he has a urgent work to do and you can't let Jeet wins. So you have to move from $0$^{$th$} position to $(N+1)$^{$th$} position such that your score will be minimum possible. Report your score to Mr. Chef when you have reach to the $(N+1)$^{$th$} position.  ###Input  The first line of the input contains a single 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$.  The second line contains $N$ spaceseparated integers $A_1, A_2, …, A_N$.  ###Output For each test case, print a single line containing your score.  ###Constraints  $1 \leq T \leq 10$  $1 \leq N, K \leq 10^5$  $1 \leq A_i \leq 10^9$ for each valid $i$  ###Sample Input 1 4 2 1 2 1 2  ###Sample Output 2  ###Explanation $Example$ $case$ $1:$ For sequence of jumping positions $0 > 1 > 3 > 5$, your score will be minimum possible, that is, $1+1 = 2$.Author:  uemco2017 
Tags  uemco2017 
Date Added:  14042019 
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, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions