- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
Ant and Ant-eater have got two arrays, each consisting of $1$ to $N$’s permutation. They want to play a game, the goal of the game is making the arrays similar. In each turn one can remove a single integer from his array. If both play optimally, find out the minimum number of turns it takes to finish the game.
ورودی
The first line of input shows the number of test cases $T$. Each test case will contain 3 lines. The first line contains a single integer $N$ indicating the length of permutations.
$$1 \leq N \leq 100 , 000$$
Second and third line each will contain $N$ space separated integers indicating the numbers in permutations A and B respectively.
خروجی
For each test case, print a single integer in a line, the minimal number of turns to finish the game.
مثالها
ورودی نمونه ۱
3
4
1 2 3 4
4 3 2 1
4
1 2 3 4
1 2 4 3
5
4 2 3 5 1
4 5 1 3 2
خروجی نمونه ۱
6
2
4
First test case:
- Ant’s: ${1, 2, 3, 4} \to {1, 3, 4} \to {1, 4} \to {4}$
- Ant-eater’s: ${4, 3, 2, 1} \to {4, 3, 1} \to {4, 1} \to {4}$
ارسال پاسخ برای این سؤال