#h. 1IXMMMl310dKFF#</["
1IXMMMl310dKFF#</["
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Statement
You are given a sequence where each element is either or . You can apply several (possibly zero) operations to the sequence. In each operation, you select two integers (where is the current length of ) and replace with a single element , where is the majority of .
Here, the majority of a sequence consisting of and is defined as follows: suppose there are zeros and ones in the sequence, respectively.
- If , the majority is .
- If , the majority is .
For example, suppose . If we select , the resulting sequence will be . If we select , the resulting sequence will be .
Determine if you can make with a finite number of operations.
Format
Input
Each test contains multiple test cases. The first line contains the number of test cases ( ). Description of the test cases follows.
The first line of each testcase contains one integer ( ).
The second line of each testcase contains a string consisting of and , describing the sequence .
It's guaranteed that the sum of over all testcases does not exceed .
Output
For each testcase, if it's possible to make , print Yes. Otherwise, print No.
Sample
5
1
0
1
1
2
01
9
100000001
9
000011000
No
Yes
No
Yes
No
ShanghaiTech ACM 炸鱼杯
- 状态
- 已结束
- 规则
- OI
- 题目
- 46
- 开始于
- 2024-12-10 23:00
- 结束于
- 2024-12-15 13:00
- 持续时间
- 110 小时
- 主持人
- 参赛人数
- 112