시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB157524644.231%

문제

Bob and Alice are participating in a programming contest as a team.

The contest has N problems which must be solved in order. Naturally there are some problems that they cannot solve, in that case they can skip it. There may be also problems that only Bob or Alice alone can solve.

They want to solve all the problems possible switching as few times as possible who is at the computer programming the solution.

Given the number of problems and the problems that Bob and Alice can solve, calculate the minimum number of switches between the usage of the computer. Anyone can start using it.

입력

The first line contains three integers N (1 ≤ N ≤ 109), A (1 ≤ A ≤ min(N, 5 ∗ 104)) and B (1 ≤ B ≤ min(N, 5 ∗ 104)). The next line contains A unique integers denoting the problems Alice can solve. The following line contains B unique integers denoting the problems Bob can solve. The first problem is denoted by the number 1, the second by number 2, the N-th by N, and so on.

출력

Print the minimum number of switches between the usage of the computer.

예제 입력 1

5 2 3
2 4
1 5 3

예제 출력 1

4

예제 입력 2

4 3 3
1 2 3
2 3 4

예제 출력 2

1

예제 입력 3

4 3 3
1 3 4
4 3 1

예제 출력 3

0

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2015 P번

  • 문제를 만든 사람: Bruno Junqueira Adami