{"trustable":true,"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":"\n \u003cp\u003eAfter returning from Wonderland, Alice needs to improve her\n scientific skills in the current digital world. Alice decides\n to participate the ACM - ICPC Asia Nha Trang Regional Contest\n 2016 to evaluate her actual performance. Her favorite problem\n in the contest is described below.\u003c/p\u003e\n \u003cp\u003eGiven an array of positive integers \u003cspan class\u003d\"tex2jax_process\"\u003e$A \u003d {a}_{1}, {a}_{2},\\ldots ,\n {a}_{n}$\u003c/span\u003e, a subarray \u003cspan class\u003d\"tex2jax_process\"\u003e${A}_{i}^{j}$\u003c/span\u003e of \u003cspan class\u003d\"tex2jax_process\"\u003e$A$\u003c/span\u003e is a sequence of continuous\n elements in \u003cspan class\u003d\"tex2jax_process\"\u003e$A$\u003c/span\u003e, i.e.,\n \u003cspan class\u003d\"tex2jax_process\"\u003e${A}_{i}^{j} \u003d {a}_{i},\n {a}_{i+1},\\ldots , {a}_{j}$\u003c/span\u003e (where \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq i \\leq j \\leq $\u003c/span\u003e n). The weight\n of \u003cspan class\u003d\"tex2jax_process\"\u003e${A}_{i}^{j}$\u003c/span\u003e is the\n sum of all its elements, i.e., \u003cspan class\u003d\"tex2jax_process\"\u003e$\\sum _{k\u003di}^{j} {a}_{k}$\u003c/span\u003e.\u003c/p\u003e\n \u003cp\u003eGiven an integer \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e,\n your task is to find the maximum weight subarray of\n \u003cspan class\u003d\"tex2jax_process\"\u003e$A$\u003c/span\u003e that contains only one\n \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e as the minimum\n element. You can assume that \u003cspan class\u003d\"tex2jax_process\"\u003e$A$\u003c/span\u003e always contains at least one\n element with value \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe input consists of several datasets. The first line of\n the input contains the number of datasets, which is a positive\n number and is not greater than \u003cspan class\u003d\"tex2jax_process\"\u003e$20$\u003c/span\u003e. The following lines describe the\n 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\n \u003cp\u003eThe first line contains two positive integers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e where \u003cspan class\u003d\"tex2jax_process\"\u003e$n \\leq {10}^{5}$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$m \\leq {2}^{6}$\u003c/span\u003e;\u003c/p\u003e\n \u003c/li\u003e\n \u003cli\u003e\n \u003cp\u003eThe second line contains \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e positive integers, each with\n value at most \u003cspan class\u003d\"tex2jax_process\"\u003e${2}^{6}$\u003c/span\u003e.\u003c/p\u003e\n \u003c/li\u003e\n \u003c/ul\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eFor each dataset, output the maximum weight.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e1\n6 2\n1 3 2 6 2 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e12\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}