{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e给定一个由$$$n$$$列组成的俄罗斯方块场地。场地中第$$$i$$$列的初始高度为$$$a_i$$$块。你只能在这些列的顶部放置大小为$$$2 \\times 1$$$的方块(即该方块的高度为$$$2$$$块,宽度为$$$1$$$块)。注意,你不能旋转这些方块。\u003c/p\u003e\u003cp\u003e你的任务是判断是否可以通过放置这样的方块来清空整个场地。\u003c/p\u003e\u003cp\u003e更正式地说,问题可以描述如下:\u003c/p\u003e\u003cp\u003e在至少有一个$$$a_i$$$大于$$$0$$$时,进行以下过程:\u003c/p\u003e\u003col\u003e \u003cli\u003e 放置一个方块$$$2 \\times 1$$$(选择一些$$$i$$$从$$$1$$$到$$$n$$$,并用$$$a_i$$$替换$$$a_i + 2$$$); \u003c/li\u003e\u003cli\u003e 然后,当所有$$$a_i$$$大于零时,用$$$a_i - 1$$$替换每个$$$a_i$$$。 \u003c/li\u003e\u003c/ol\u003e\u003cp\u003e你的任务是确定是否可能清空整个场地(即完成所描述的过程),并适当选择新方块的位置。\u003c/p\u003e\u003cp\u003e你需要回答$$$t$$$个独立的测试用例。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e输入的第一行包含一个整数$$$t$$$($$$1 \\le t \\le 100$$$) —— 测试用例的数量。\u003c/p\u003e\u003cp\u003e接下来的$$$2t$$$行描述了测试用例。测试用例的第一行包含一个整数$$$n$$$($$$1 \\le n \\le 100$$$) —— 俄罗斯方块场地的列数。测试用例的第二行包含$$$n$$$个整数$$$a_1, a_2, \\dots, a_n$$$($$$1 \\le a_i \\le 100$$$),其中$$$a_i$$$是俄罗斯方块场地中第$$$i$$$列的初始高度。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,如果你可以清空整个俄罗斯方块场地,则打印答案为“\u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e”(不带引号),否则打印“\u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\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\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\u003e4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\nNO\nYES\nYES\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\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/abf06928fcafb0e6cf3acab2fc7466bd?v\u003d1701197497\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\u003cp\u003e灰色线条表示俄罗斯方块场地的边界。注意场地没有上边界。\u003c/p\u003e\u003cp\u003e一个正确的答案是首先在第一列放置方块。然后在过程的第二步之后,场地变为$$$[2, 0, 2]$$$。然后在第二列放置方块,在过程的第二步之后,场地变为$$$[0, 0, 0]$$$。\u003c/p\u003e\u003cp\u003e示例场地的第二个测试用例如下所示:\u003c/p\u003e\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/e32dad48c44731e4dd5f779287164f89?v\u003d1701197497\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\u003cp\u003e可以证明你无法做任何操作来结束这个过程。\u003c/p\u003e\u003cp\u003e示例场地的第三个测试用例中,你首先在第二列放置方块,在过程的第二步之后,场地变为$$$[0, 2]$$$。然后在第一列放置方块,在过程的第二步之后,场地变为$$$[0, 0]$$$。\u003c/p\u003e\u003cp\u003e示例场地的第四个测试用例中,首先在第一列放置方块,然后在第一步之后,场地变为$$$[102]$$$,然后在第二步之后,场地变为$$$[0]$$$。\u003c/p\u003e"}}]}