{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section 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\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003e德裕村包子铺现有N份工作需要找人完成。你最近在这M天内手头很紧,需要用钱,于是就想从这n份工作中选部分挣点生活费。但由于包子铺生意火爆,流动资金不够充裕,因此你只有完成某份工作后的第ai天才能获得bi的报酬。\n\u003cp\u003e你一天最多只能完成一个工作,当然也可以选择不做;同时你也不能做一个你已经做过的工作。\n\u003cp\u003e现在为了让你M天内的生活费最充裕,希望你求出在m天内你可以获得的最大报酬;\n"}},{"title":"Constraints","value":{"format":"HTML","content":" 以上所有输入都是正整数。\n\u003cp\u003e\n\u003cimg src\u003d\"https://latex.codecogs.com/gif.latex?\\\\1\u0026space;\\leq\u0026space;N\u0026space;\\leq\u0026space;10^5\\\\\u0026space;1\u0026space;\\leq\u0026space;M\u0026space;\\leq\u0026space;10^5\\\\\u0026space;1\u0026space;\\leq\u0026space;A_i\u0026space;\\leq\u0026space;10^5\\\\\u0026space;1\u0026space;\\leq\u0026space;B_i\u0026space;\\leq\u0026space;10^4\\\\\" /\u003e\u003c/a\u003e\n\u003c/ul\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003e输入格式如下,中间有空格\u003c/p\u003e \n\u003ca target\u003d\"_blank\"\u003e\u003cimg src\u003d\"https://latex.codecogs.com/gif.latex?\\\\N\u0026space;M\\\\\u0026space;A_1\u0026space;B_1\\\\\u0026space;A_2\u0026space;B_2\\\\\u0026space;\\vdots\\\\\u0026space;A_N\u0026space;B_N\\\\\" /\u003e\u003c/a\u003e\n\u003c/pre\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003e求出M天内可以获得的最大报酬.\u003c/p\u003e"}},{"title":"Sample Input 1","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e3 4\n4 1\n4 3\n2 2\n\u003c/pre\u003e"}},{"title":"Sample Output 1","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e5\n\u003c/pre\u003e \n\n\u003cp\u003e第1天做第2份工作,然后在第4天获得价值为3的报酬然后在第2天做第三份工作,可以在第3天获得价值为2的报酬,所以在4天内最多可以收获价值为5的报酬\u003c/p\u003e\n\u003cp\u003e其中在第2天的时候不能选第1个工作了,若选了,那么需要在第5天的时候才能获得价值为1的报酬,但要求的是在4天内获得的报酬。\u003c/p\u003e"}},{"title":"Sample Input 2","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\u003c/pre\u003e"}},{"title":"Sample Output 2","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e10\n\u003c/pre\u003e"}},{"title":"Sample Input 3","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e1 1\n2 1\n\u003c/pre\u003e"}},{"title":"Sample Output 3","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e0\n\u003c/pre\u003e"}}]}