{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e给你两个序列 $$$a_1, a_2, \\dots, a_n$$$ 和 $$$b_1, b_2, \\dots, b_n$$$。每个序列的元素都是 $$$0$$$、$$$1$$$ 或 $$$2$$$ 中的一个。序列 $$$a$$$ 中元素 $$$0$$$、$$$1$$$、$$$2$$$ 的个数分别为 $$$x_1$$$、$$$y_1$$$、$$$z_1$$$,序列 $$$b$$$ 中元素 $$$0$$$、$$$1$$$、$$$2$$$ 的个数分别为 $$$x_2$$$、$$$y_2$$$、$$$z_2$$$。\u003c/p\u003e\u003cp\u003e你可以随意重新排列序列 $$$a$$$ 和 $$$b$$$ 中的元素。然后,我们定义一个序列 $$$c$$$ 如下:\u003c/p\u003e\u003cp\u003e$$$c_i \u003d \\begin{cases} a_i b_i \u0026amp; \\mbox{if }a_i \u0026gt; b_i \\\\ 0 \u0026amp; \\mbox{if }a_i \u003d b_i \\\\ -a_i b_i \u0026amp; \\mbox{if }a_i \u0026lt; b_i \\end{cases}$$$\u003c/p\u003e\u003cp\u003e你希望使序列 $$$c$$$ 的和 $$$\\sum_{i\u003d1}^n c_i$$$ 尽可能大。最大可能的和是多少?\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数 $$$t$$$ ($$$1 \\le t \\le 10^4$$$) —— 测试用例的数量。\u003c/p\u003e\u003cp\u003e每个测试用例包括两行。每个测试用例的第一行包含三个整数 $$$x_1$$$、$$$y_1$$$、$$$z_1$$$ ($$$0 \\le x_1, y_1, z_1 \\le 10^8$$$) —— 序列 $$$a$$$ 中 $$$0$$$、$$$1$$$、$$$2$$$ 的个数。\u003c/p\u003e\u003cp\u003e每个测试用例的第二行也包含三个整数 $$$x_2$$$、$$$y_2$$$、$$$z_2$$$ ($$$0 \\le x_2, y_2, z_2 \\le 10^8$$$; $$$x_1 + y_1 + z_1 \u003d x_2 + y_2 + z_2 \u0026gt; 0$$$) —— 序列 $$$b$$$ 中 $$$0$$$、$$$1$$$、$$$2$$$ 的个数。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,打印序列 $$$c$$$ 的最大可能和。\u003c/p\u003e"}},{"title":"示例 1","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\u003e3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n2\n0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e在第一个示例中,一个最优解之一是:\u003c/p\u003e\u003cp\u003e$$$a \u003d \\{2, 0, 1, 1, 0, 2, 1\\}$$$\u003c/p\u003e\u003cp\u003e$$$b \u003d \\{1, 0, 1, 0, 2, 1, 0\\}$$$\u003c/p\u003e\u003cp\u003e$$$c \u003d \\{2, 0, 0, 0, 0, 2, 0\\}$$$\u003c/p\u003e\u003cp\u003e在第二个示例中,一个最优解之一是:\u003c/p\u003e\u003cp\u003e$$$a \u003d \\{0, 2, 0, 0, 0\\}$$$\u003c/p\u003e\u003cp\u003e$$$b \u003d \\{1, 1, 0, 1, 0\\}$$$\u003c/p\u003e\u003cp\u003e$$$c \u003d \\{0, 2, 0, 0, 0\\}$$$\u003c/p\u003e\u003cp\u003e在第三个示例中,唯一可能的解是:\u003c/p\u003e\u003cp\u003e$$$a \u003d \\{2\\}$$$\u003c/p\u003e\u003cp\u003e$$$b \u003d \\{2\\}$$$\u003c/p\u003e\u003cp\u003e$$$c \u003d \\{0\\}$$$\u003c/p\u003e"}}]}