Ограничения: время – 1s/2s, память – 64MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод
Послать решение Blockly Посылки Темы Где Обсудить (0)
You are given two list of integers. You can remove any number of elements
from any of them. You have to ensure that after removing some elements both of the list will
contain same elements, but not necessarily in same order. For example consider the following two lists
List #1: 1 2 3 2 1
List #2: 1 2 5 2 3
After removing 1 from first list and 5 from second list, both lists will contain same elements.
We will find the following lists after removing two elements.
List #1: 1 2 3 2
List #2: 1 2 2 3
What is the minimum number of elements to be removed to obtain two list having same elements?
Input
First line will contain two integers `N` (`1\ ≤\ N\ ≤\ 100000`), the number of element in the
first list and `M` (`1\ ≤\ M\ ≤\ 100000`), the number of element in the second list.
The next line will contain `N` integers representing the first list followed by another
line having `M` elements representing the second list. Each integers in the input is 32 bit signed integer.
Output
Output a single line containing the number of elements to be removed.
Sample Input
5 5
1 2 3 2 1
1 2 5 2 3