{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"超市里有N个商品. 第i个商品必须在保质期(第di天)之前卖掉, 若卖掉可让超市获得pi的利润. \n每天只能卖一个商品.\n现在你要让超市获得最大的利润. "}},{"title":"Input","value":{"format":"MD","content":"多组数据. \n每组数据第一行为一个整数N (0 \u003c\u003d N \u003c\u003d 10000), 即超市的商品数目\n之后N行各有两个整数, 第i行为 pi, di (1 \u003c\u003d pi, di \u003c\u003d 10000)"}},{"title":"Output","value":{"format":"MD","content":"对于每一组数据, 输出当前条件下超市的最大利润"}},{"title":"Sample Input","value":{"format":"MD","content":"4 \n50 2 \n10 1 \n20 2 \n30 1\n\n7 \n20 1 \n2 1 \n10 3 \n100 2 \n8 2 \n5 20 \n50 10"}},{"title":"Sample Output","value":{"format":"MD","content":"80\n185"}},{"title":"Hint","value":{"format":"MD","content":"Translated by shleodai"}}]}