{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"\u003cp\u003e \u003c/p\u003e\n\u003cp\u003eHogathon is the most exciting event of Bitotsav. \u003c/p\u003e\n\u003cp\u003e There are \u003cb\u003eK\u003c/b\u003e teams participating in this event. Each team needs to send 2 members for this event. This time only cupcakes are available for the participants. There are \u003cb\u003eN\u003c/b\u003e * \u003cb\u003eN\u003c/b\u003e cupcakes in total which are arranged in the shape of a square matrix, a cupcake in each cell of the matrix\u003c/p\u003e\n\n\u003cp\u003e Let the leftmost cell in the top row be denoted by (1,1) and the rightmost cell in the bottom row be (N,N).\nThe rules of the event are as follows : \u003c/p\u003e\n\u003cp\u003e1) The 2 members from team have to eat a cupcake each. \u003c/p\u003e\n\u003cp\u003e2) The cupcakes chosen by the 2 members need to be adjacent i.e they can be one of the below combinations : \u003c/p\u003e\n \u003cli\u003e(x, y) and (x + 1, y)\u003c/li\u003e\n \u003cli\u003e(x, y) and (x - 1 ,y) \u003c/li\u003e\n \u003cli\u003e(x, y) and (x, y - 1) \u003c/li\u003e\n \u003cli\u003e(x, y) and (x, y + 1)\u003c/li\u003e\n\u003cp\u003e \u003c/p\u003e\n3) No cupcake can be chosen more than once i.e a cupcake once chosen is removed from the matrix. \u003c/p\u003e\n\u003cp\u003e\nEach cupcake has a sweetness factor associated with it. Your task is to \u003cb\u003eminimize\u003c/b\u003e the sum of the sweetness of cupcakes remaining in the matrix after the turn of K teams.\n\u003c/p\u003e\n\u003c/p\u003e\n\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003eThe first line of input contains two integers \u003cb\u003eN\u003c/b\u003e and \u003cb\u003eK\u003c/b\u003e denoting the number of rows of matrix and number of teams respectively. \u003c/li\u003e\n\u003cli\u003e The next \u003cb\u003eN\u003c/b\u003e lines contain \u003cb\u003eN\u003c/b\u003e space separated integers each describing the sweetness factor of the cupcakes \u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e \u003c/p\u003e\n\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003ePrint the minimum sum of sweetness factor of cupcakes remaining in the matrix after the \u003cb\u003eK\u003c/b\u003e teams have consumed the cupcakes\u003c/p\u003e\n\n\u003ch3\u003eConstraints\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cb\u003e1\u003c/b\u003e ≤ \u003cb\u003eN\u003c/b\u003e ≤ \u003cb\u003e3000\u003c/b\u003e\u003c/li\u003e\n\u003cli\u003e\u003cb\u003e1\u003c/b\u003e ≤ \u003cb\u003eK\u003c/b\u003e ≤ \u003cb\u003e8\u003c/b\u003e\u003c/li\u003e\n\u003cli\u003e\u003cb\u003e0\u003c/b\u003e ≤ \u003cb\u003eSweetness Factor\u003c/b\u003e ≤ \u003cb\u003e1000\u003c/b\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e \u003c/p\u003e\n\u003ch3\u003eExample\u003c/h3\u003e\n\u003cpre\u003e\u003cb\u003eInput:\u003c/b\u003e\n3 1\n2 7 6\n9 5 1\n4 3 8\n\n\u003cb\u003eOutput:\u003c/b\u003e\n31\n\u003c/pre\u003e\n\u003cp\u003e \u003c/p\u003e\n\u003ch3\u003eExplanation\u003c/h3\u003e\n\u003cp\u003e\u003cb\u003eExample case 1.\u003c/b\u003e Team 1 chooses the cupcakes present in (2,1) and (2,2) \u003c/p\u003e"}}]}