{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eBesides the prestigious ACM-ICPC contest, Nha Trang University also hosted the Vietnamese Collegiate Olympiads in Informatics 2016. This Olympiad had several events where students compete individually to show their skills and knowledge.\u003c/p\u003e \n\u003cp\u003eAfter a successful contest this year, \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e junior students in Nha Trang University expressed their interests to join the team next year to represent their university. But in order for them to be at a medal contender level, the coach, Mr. Van, has to teach them \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e topics. The \u003cspan class\u003d\"tex2jax_process\"\u003e${i}^\\textrm {th}$\u003c/span\u003e student will require \u003cspan class\u003d\"tex2jax_process\"\u003e${a}_{i,j}$\u003c/span\u003e minutes to understand the \u003cspan class\u003d\"tex2jax_process\"\u003e${j}^\\textrm {th}$\u003c/span\u003e topic. Teaching \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e students \u003cspan class\u003d\"tex2jax_process\"\u003e${X}_{1}, {X}_{2},\\ldots , {X}_{k}$\u003c/span\u003e the \u003cspan class\u003d\"tex2jax_process\"\u003e${j}^\\textrm {th}$\u003c/span\u003e topic will require \u003cspan class\u003d\"tex2jax_process\"\u003e$max({a}_{{x}_{k,j}}, {a}_{{x}_{2,j}},\\ldots , {a}_{{x}_{k,j}})$\u003c/span\u003e minutes and teaching them all \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e topics will require \u003cspan class\u003d\"tex2jax_process\"\u003e$\\sum _{j\u003d1}^{M} max({a}_{{x}_{1,j}}, {a}_{{x}_{2,j}},\\ldots , {a}_{{x}_{k,j}})$\u003c/span\u003e minutes.\u003c/p\u003e \n\u003cp\u003eGiven \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e - the number of students in a group to train, your task is to help Mr. Van decide who he should pick in order to minimize the total time he needs to teach them all \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e topics.\u003c/p\u003e\n"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of several datasets. The first line of the input contains the number of datasets which is a positive integer and is not greater than \u003cspan class\u003d\"tex2jax_process\"\u003e$100$\u003c/span\u003e. The following lines describe the datasets.\u003c/p\u003e \n\u003cp\u003eEach dataset is described by the following lines:\u003c/p\u003e \n\u003cul class\u003d\"itemize\"\u003e \n \u003cli\u003e \u003cp\u003eThe first line contains three integers \u003cspan class\u003d\"tex2jax_process\"\u003e$N, M, Q$\u003c/span\u003e \u003cspan class\u003d\"tex2jax_process\"\u003e$(1 \\leq Q \\leq N \\leq 20, M \\leq 10\\, 000)$\u003c/span\u003e.\u003c/p\u003e \u003c/li\u003e \n \u003cli\u003e \u003cp\u003eThe \u003cspan class\u003d\"tex2jax_process\"\u003e${i}^\\textrm {th}$\u003c/span\u003e line of the next \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e lines contains \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e integers \u003cspan class\u003d\"tex2jax_process\"\u003e${a}_{i,j}$\u003c/span\u003e \u003cspan class\u003d\"tex2jax_process\"\u003e$(0 \\leq {a}_{i,j} \\leq {10}^{9})$\u003c/span\u003e.\u003c/p\u003e \u003c/li\u003e \n \u003cli\u003e \u003cp\u003eThe \u003cspan class\u003d\"tex2jax_process\"\u003e${u}^\\textrm {th}$\u003c/span\u003e line of the next \u003cspan class\u003d\"tex2jax_process\"\u003e$Q$\u003c/span\u003e lines contains a query which is an integer \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e \u003cspan class\u003d\"tex2jax_process\"\u003e$(1 \\leq K \\leq N)$\u003c/span\u003e representing the number of students in the group that Mr. Van needs to train.\u003c/p\u003e \u003c/li\u003e \n\u003c/ul\u003e "}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each dataset, output \u003cspan class\u003d\"tex2jax_process\"\u003e$Q$\u003c/span\u003e lines where the \u003cspan class\u003d\"tex2jax_process\"\u003e${i}^\\textrm {th}$\u003c/span\u003e line contains the minimal time required for the \u003cspan class\u003d\"tex2jax_process\"\u003e${i}^\\textrm {th}$\u003c/span\u003e query.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n2 2 1\n1 3\n3 2\n1\n3 3 3\n1 4 9\n2 6 3\n3 5 5\n1\n2\n3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n11\n14\n18\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}