Problem N: Good Bye and Sorry

Xem dạng PDF

Gửi bài giải

Điểm: 1,00
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Tác giả:
Dạng bài

Trong trường hợp đề bài hiển thị không chính xác, bạn có thể tải đề bài tại đây: Đề bài

In a small village nestled in the heart of the wilderness, Chưng and Quýt, two close friends, were given an important mission. Their village lies along two large rivers, separating three riverbanks, each numbered from 1 to 3. Their task is to build bridges across the rivers so people can travel from the first bank to the second, and then to the third. Each riverbank has bridge pillars, with each pillar marked by a different symbol.

To build a bridge between two banks, the pillars on both sides must have matching symbols. Importantly, no two bridges are allowed to overlap or cross each other. The question is: How many bridges can Chưng and Quýt build, at most, to connect the first bank to the third?


Input

The first line contains integers ~a_i~ ~(|a_i| < 10^5; 0 < i ≤ 100)~, represents the first bridge pillars.

The second line contains integers ~b_i~ ~(|b_i| < 10^5; 0 < i ≤ 100)~, represents the second bridge pillars.

The third line contains integers ~c_i~ ~(|c_i| < 10^5; 0 < i ≤ 100)~, represents the third bridge pillars.


Output

A single value is the answer to the problem.


Sample Input 1

3 2 1 9 10 3 8 4 9 2 3 4
1 3 2 9 4 2 4 2 3 4 5 2 4
1 3 2 9 3 2 2 4 2 2 9 4 2 3 4 4 2 1

Sample Ouput 1

7

Sample Input 2

2 1 3 5 3 8 5 9 4
1 2 3 4 8 9 12 14
4 1 2 3 4 8 12 9 14 9 2

Sample Ouput 2

4

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.