{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e pre { text-align:left; font-family: \"Courier New\", Courier, monospace; font-size: 16px; white-space: pre; line-height:20px; text-indent: 0px; }\u003c/style\u003e\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eXzz is a child with severe procrastinations. The new semester begins, He still has a lot of homework to do. Now there are K friends help him finish his homework. Xzz has a necklace with n pearl. Now he want to Split into k parts, and send them to these k friends. Each friend will have a value representative how happy they are. And the value is equal the square of sum of the pearl in one part. Now Xzz wants to know minimum sum of his k friends value. \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eFirst line of the input file contains an integer T(0 \u0026lt; T ≤ 20) that indicates how many cases of inputs are there. \u003c/p\u003e\n \u003cp\u003eThe description of each case is given below: \u003c/p\u003e\n \u003cp\u003eThe first line of each case contains two numbers n, k, means there is n pearl necklace and k friends. n, k ≤ 200 \u003c/p\u003e\n \u003cp\u003eThen follow n lines. In ith line there will be n numbers, ai, means the value of ith pearl.1 ≤ ai ≤ 100\u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eOne integer means the minimum sum of his k friends value. \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\r\n3 3\r\n1 2 3\r\n5 3\r\n5 2 3 8 2\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e14\r\n138\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\n \u003cp\u003eEach part must be continuous at necklace. \u003c/p\u003e\n \u003cp\u003eCase 2, three parts are {2, 3}, {8}, {5, 2}\u003c/p\u003e\n \u003cp\u003e(2 + 3)^2 + 8^2 + (2 + 5)^2\u003c/p\u003e\n \u003cp\u003e\u003cimg src\u003d\"CDN_BASE_URL/aeff69473c20168b893efadf4e85de6f?v\u003d1620126620\" width\u003d\"100%\" height\u003d\"100%\"\u003e \u003c/p\u003e\n "}}]}