If only I had held the hero's hand instead of the commemorative coin back then...
There are $$$n$$$ commemorative coins arranged in a row. Initially, all coins are facing up.
In one operation, you can choose a consecutive segment of exactly $$$k$$$ coins and flip all of them.
Given a final state $$$s$$$ describing whether each coin is heads up or tails up, determine if it is possible to reach this state from the initial state using any number of operations (including zero operations).
The first line contains a positive integer $$$T$$$ $$$(1 \le T \le 2 \times 10^5)$$$, denoting the number of test cases.
For each test case:
It is guaranteed that the sum of $$$n$$$ across all test cases in a single test set does not exceed $$$2 \times 10^5$$$.
For each test case, output a single line containing Yes if the state is reachable, otherwise output No. The answer is case-insensitive.
25 3011103 2100
YES NO
| Название |
|---|


