#P8301. [CoE R4 A/Stoi2041] 娘子
[CoE R4 A/Stoi2041] 娘子
Background
Problem Description
Given two - sequences and , both of length . First, you may choose some to flip, i.e., change to and to . Then, you may permute sequence in any order.
After the above process, it is required that equals . Find the minimum number of flips.
Input Format
The first line contains a positive integer . The second line contains numbers representing sequence . The third line contains numbers representing sequence .
Output Format
Output one integer representing the answer.
3
110
101
0
5
10010
00100
1
Hint
Sample Explanation
Input #1: Reorder into to meet the requirement, so the minimum number of flips is .
Input #2: Flip the fourth bit of (counting from left to right), obtaining , then reorder it to get , which meets the requirement, so the minimum number of flips is .
Constraints
- For of the testdata, .
- For another of the testdata, .
- For another of the testdata, .
- For of the testdata, , , .
Translated by ChatGPT 5