{"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":"\n\u003cp\u003e卡尔松最近在房子的地下室发现了一大堆浆果果酱罐。更具体地说,有$$$2n$$$罐草莓和蓝莓果酱。\u003c/p\u003e\n\u003cp\u003e所有$$$2n$$$罐都排成一行。地下室的楼梯正好在这一行的中间。所以当卡尔松进入地下室时,他的左边有$$$n$$$罐,右边也有$$$n$$$罐。\u003c/p\u003e\n\u003cp\u003e例如,地下室可能是这样的:\u003c/p\u003e\n\u003ccenter\u003e\n \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/4fa49f440b5b3b5c2e84328df9415149?v\u003d1696948714\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\n\u003c/center\u003e\n\u003cp\u003e作为一个直截了当的人,他立即开始吃果酱。在一分钟内,他选择要清空他左边的第一个非空罐子,或者他右边的第一个非空罐子。\u003c/p\u003e\n\u003cp\u003e最后,卡尔松决定最终草莓和蓝莓果酱罐的数量应该相同。\u003c/p\u003e\n\u003cp\u003e例如,这可能是结果:\u003c/p\u003e\n\u003ccenter\u003e\n \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/19168d3214692c8c7e4f73950ef35880?v\u003d1696948714\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003e他先吃了左边的$$$1$$$罐,然后吃了右边的$$$5$$$罐。\u003c/span\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003e剩下的草莓和蓝莓果酱罐都有$$$3$$$罐。\u003c/span\u003e\n\u003c/center\u003e\n\u003cp\u003e罐子从左到右编号为$$$1$$$到$$$2n$$$,所以卡尔松最初站在$$$n$$$和$$$n+1$$$之间的罐子中间。\u003c/p\u003e\n\u003cp\u003e卡尔松需要清空的最少罐子数量是多少,才能剩下相同数量的草莓和蓝莓果酱罐?\u003c/p\u003e\n\u003cp\u003e你的程序应该回答$$$t$$$个独立的测试用例。\u003c/p\u003e\n"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数$$$t$$$($$$1 \\le t \\le 1000$$$)——测试用例的数量。\u003c/p\u003e\n\u003cp\u003e每个测试用例的第一行包含一个整数$$$n$$$($$$1 \\le n \\le 10^5$$$)。\u003c/p\u003e\n\u003cp\u003e每个测试用例的第二行包含$$$2n$$$个整数$$$a_1, a_2, \\dots, a_{2n}$$$($$$1 \\le a_i \\le 2$$$)——$$$a_i\u003d1$$$表示从左边数第$$$i$$$个罐子是草莓果酱罐,$$$a_i\u003d2$$$表示是蓝莓果酱罐。\u003c/p\u003e\n\u003cp\u003e保证所有测试用例中$$$n$$$的总和不超过$$$10^5$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,输出答案——卡尔松需要清空的最少罐子数量,以便剩下相同数量的草莓和蓝莓果酱罐。\u003c/p\u003e"}},{"title":"示例1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003e输入\u003c/th\u003e\n \u003cth\u003e输出\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\n6\n1 1 1 2 2 1 2 1 2 1 1 2\n2\n1 2 1 2\n3\n1 1 1 1 1 1\n2\n2 1 1 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\n0\n6\n2\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\n\u003cp\u003e在第二个测试用例中,草莓和蓝莓果酱罐的数量已经相等。\u003c/p\u003e\n\u003cp\u003e在第三个测试用例中,卡尔松需要吃掉所有的$$$6$$$个罐子,这样就剩下$$$0$$$个果酱罐。\u003c/p\u003e\n\u003cp\u003e在第四个测试用例中,卡尔松可以清空第二个和第三个罐子,或者第三个和第四个罐子。这两种情况都会剩下$$$1$$$个果酱罐。\u003c/p\u003e"}}]}