#P10766. 「CROI · R2」01-string
「CROI · R2」01-string
Description
Given two 01-strings and of length , you can perform the following operations on string infinitely many times. In each operation, you may choose one of the following:
-
Select two positive integers and flip the 01 values of (i.e., change 0 to 1 and 1 to 0).
-
Select two positive integers and set all characters in to 0.
-
Select two positive integers and set all characters in to 1.
Your task is to determine the minimum number of operations required to transform into .
Input Format
The problem uses multiple test cases.
The first line contains a positive integer , indicating the number of test cases.
For each test case:
-
The first line contains a 01-string representing .
-
The second line contains a 01-string representing .
Output Format
Output lines, where the -th line contains an integer representing the answer for the -th test case.
3
00000
11111
10101
01010
11100101
11110000
1
1
2
Hint
【Sample Explanation】
Below is one valid solution for each of the three sample test cases:
-
For the first test case, select and set all characters in to 1.
-
For the second test case, select and flip the 01 values of .
-
For the third test case, first select and flip the 01 values of , then select and set all characters in to 0.
【Data Range】
This problem uses bundled tests.
- Subtask 0 (10 points): .
- Subtask 1 (10 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): No additional constraints.
For all test cases, and .
京公网安备 11011102002149号