ساعت
۹۰۱۲۳۴۵۶۷۸۹۰۹۰۱۲۳۴۵۶۷۸۹۰
ساعت
دقیقه
۹۰۱۲۳۴۵۶۷۸۹۰۹۰۱۲۳۴۵۶۷۸۹۰
دقیقه
ثانیه
۹۰۱۲۳۴۵۶۷۸۹۰۹۰۱۲۳۴۵۶۷۸۹۰
ثانیه
  • محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

Ant and Ant-eater have got two arrays, each consisting of 11 to NN’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 TT. Each test case will contain 3 lines. The first line contains a single integer NN indicating the length of permutations.

1N100,0001 \leq N \leq 100 , 000

Second and third line each will contain NN 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
Plain text

خروجی نمونه ۱

6
2
4
Plain text

First test case:

  • Ant’s: 1,2,3,41,3,41,44{1, 2, 3, 4} \to {1, 3, 4} \to {1, 4} \to {4}
  • Ant-eater’s: 4,3,2,14,3,14,14{4, 3, 2, 1} \to {4, 3, 1} \to {4, 1} \to {4}

توضیح تصویر


ارسال پاسخ برای این سؤال
فایلی انتخاب نشده است.