{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"dcm师哥某天感觉很无聊,给了你n对数(也就是2n个数),每对数有一个a,和一个b,对于任何对数ai和bi,你有以下三种选择:1. 都不选 2. 选ai,3. 既选ai又选bi(也就是说,如果想选bi,ai必须是已经选了的)。用函数f(x)表示选择k个数的最大的和,现在让你输出f(1),f(2),...f(2n)的值"}},{"title":"Input","value":{"format":"MD","content":"第一行一个T表示样例数(1 \u003c\u003d T \u003c\u003d 90)\n\n每组用例,第一行两个数n,如题上所述(1 \u003c\u003d n \u003c\u003d 100000)\n\n接下来n行,每行两个数ai bi,如上题所述(1 \u003c\u003d ai,bi \u003c\u003d 10000)"}},{"title":"Output","value":{"format":"MD","content":"在同一行输出f(1),f(2),...f(2n)的值"}},{"title":"Sample Input","value":{"format":"MD","content":"\u003cpre\u003e1\n2\n4 200\n3 400\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"MD","content":"\u003cpre\u003e4 403 407 607\n\u003c/pre\u003e"}}]}