Logo
(追記) (追記ここまで)

11540번 - Competition 다국어

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

문제

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
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /