{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"MD","content":"You are given a sequence of $n$ integers. ( $|a_i| \\leq 15007$ , $1\\leq n\\leq 50000$ ). A query is defined as follows:\n\tQuery(x,y) \u003d Max {$a_i+a_{i+1}+...+a_j; x\\leq i\\leq j\\leq y$}\nThat is, the **Maximum subarray sum within [x, y]**.\n\tGiven $m$ queries, your program must output the results of these queries."}},{"title":"Input","value":{"format":"MD","content":"- The first line of the input file contains the integer $n$.\n- In the second line, $n$ space separated integers.\n- The third line contains an integer $m$, the number of queries.\n- $m$ lines follow, where line $i$ contains 2 numbers $x_i$ and $y_i$."}},{"title":"Output","value":{"format":"MD","content":"Your program should output the results of the $m$ queries, one query per line."}},{"title":"Sample testcase","value":{"format":"MD","content":"\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\n\u003cpre\u003e\n3 \n-1 2 3\n1\n1 2\u003c/pre\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\u003cpre\u003e2\u003c/pre\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}