#P1381A1. Prefix Flip (Easy Version)
Prefix Flip (Easy Version)
Description
This is the easy version of the problem. The difference between the versions is the constraint on and the required number of operations. You can make hacks only if all versions of the problem are solved.
There are two binary strings and of length (a binary string is a string consisting of symbols and ). In an operation, you select a prefix of , and simultaneously invert the bits in the prefix ( changes to and changes to ) and reverse the order of the bits in the prefix.
For example, if and you select the prefix of length , it becomes . Then if you select the entire string, it becomes .
Your task is to transform the string into in at most operations. It can be proved that it is always possible.
The first line contains a single integer () — the number of test cases. Next lines contain descriptions of test cases.
The first line of each test case contains a single integer () — the length of the binary strings.
The next two lines contain two binary strings and of length .
It is guaranteed that the sum of across all test cases does not exceed .
For each test case, output an integer (), followed by integers (). Here is the number of operations you use and is the length of the prefix you flip in the -th operation.
Input
The first line contains a single integer () — the number of test cases. Next lines contain descriptions of test cases.
The first line of each test case contains a single integer () — the length of the binary strings.
The next two lines contain two binary strings and of length .
It is guaranteed that the sum of across all test cases does not exceed .
Output
For each test case, output an integer (), followed by integers (). Here is the number of operations you use and is the length of the prefix you flip in the -th operation.
Note
In the first test case, we have .
In the second test case, we have .
In the third test case, the strings are already the same. Another solution is to flip the prefix of length , which will leave unchanged.