{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"长度为n的整数数组的中间值是元素的非递减顺序中位于⌈n/2⌉(向上取整)位置的数字。\n位置从1开始编号。例如,数组[2,6,4,1,3,5]的中值下标为3。还有一些关于中值的其他定义,但是在这个问题中,我们将使用所描述的定义。\n给定两个整数n和k以及n*k长度的非递减数组。\n现在将所有数字分成大小为n的k个数组,这样每个数字就只属于一个数组。\n找到k个数组的中间值和的最大值"}},{"title":"输入格式","value":{"format":"MD","content":"第一行包含单个整数t(1≤t≤100)——测试用例的数量。接下来的2t行包含测试用例的描述。\n每个测试用例描述的第一行包含两个整数n,k(1≤n,k≤1000)。\n每个测试用例描述的第二行包含n*k整数a1,a2,…,an*k(0≤ai≤1^9)-给定数组。保证阵列不递减:a1≤a2≤…≤ank。\n保证所有测试用例的n*k总和不超过2*1^5。"}},{"title":"输出格式","value":{"format":"MD","content":"对于每个测试用例,输出所有k组数的中间值之和的最大值。"}},{"title":"样例","value":{"format":"MD","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e6\n2 4\n0 24 34 58 62 64 69 78\n2 2\n27 61 81 91\n4 3\n2 4 16 18 21 27 36 53 82 91 92 95\n3 4\n3 11 12 22 33 35 38 67 69 71 94 99\n2 1\n11 41\n3 3\n1 1 1 1 1 1 1 1 1\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e165\n108\n145\n234\n11\n3\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"提示","value":{"format":"MD","content":"第一次测试的所有测试用例可能划分为数组的示例:\n测试用例1:[0,24]、[34,58]、[62,64]、[69,78]。中位数为0,34,62,69。他们的总和是165。\n测试用例2:[27,61],[81,91]。中位数是27,81。他们的总和是108。\n测试用例3:[2,91,92,95],[4,36,53,82],[16,18,21,27]。中位数是91,36,18。他们的总和是145。\n测试用例4:[3,33,35],[11,94,99],[12,38,67],[22,69,71]。中位数是33,94,38,69。他们的总和是234。\n测试用例5:[11,41]。中位数是11。唯一的中值之和是11。\n测试用例6:[1,1,1],[1,1,1],[1,1,1]。中位数是1,1,1。他们的总和是3。"}}]}