{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ \u003ci\u003emoney\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ 10,000) that he will need to spend each day over the next \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 100,000) days.\u003c/p\u003e\u003cp\u003eFJ wants to create a budget for a sequential set of exactly \u003ci\u003eM\u003c/i\u003e (1 ≤ \u003ci\u003eM\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e) fiscal periods called \"fajomonths\". Each of these fajomonths contains a set of 1 or more consecutive days. Every day is contained in exactly one fajomonth.\u003c/p\u003e\u003cp\u003eFJ\u0027s goal is to arrange the fajomonths so as to minimize the expenses of the fajomonth with the highest spending and thus determine his monthly spending limit.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Line 1: Two space-separated integers: \u003ci\u003eN\u003c/i\u003e and \u003ci\u003eM\u003c/i\u003e\r\u003cbr\u003eLines 2..\u003ci\u003eN\u003c/i\u003e+1: Line \u003ci\u003ei\u003c/i\u003e+1 contains the number of dollars Farmer John spends on the \u003ci\u003ei\u003c/i\u003eth day"}},{"title":"Output","value":{"format":"HTML","content":"Line 1: The smallest possible monthly limit Farmer John can afford to live with."}},{"title":"Sample","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\u003e7 5\r\n100\r\n400\r\n300\r\n100\r\n500\r\n101\r\n400\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e500\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"If Farmer John schedules the months so that the first two days are a month, the third and fourth are a month, and the last three are their own months, he spends at most $500 in any month. Any other method of scheduling gives a larger minimum monthly limit."}}]}