- ← Back
- P1 (1)
- P1 (2)
- P2 (1)
- P2 (2)
- P3 (1)
- P3 (2)
- P3 (3)
- P3 (4)
- P4 (1)
- P4 (2)
- P4 (3)
- P4 (4)
- P4 (5)
- P4 (6)
- P4 (7)
- P4 (8)
- P5 (1)
- P5 (2)
- P5 (3)
- P5 (4)
- P6 (1)
- P6 (2)
- P6 (3)
- P6 (4)
- Гурток 1A
- Гурток 1B
- Гурток 1С
- Гурток 1D
- Гурток 1E
- Гурток 1F
- Гурток 2A
- Гурток 2B
- Гурток 2C
- Гурток 2D
- Гурток 2Е
- Гурток 2F
The Easiest Problem
Limits: 2 sec., 256 MiB
Each problemset must contain at least one easy problem. And the easiest problem should be somewhere in the middle. So, here it is right in the middle of the problemset. You can treat it as a gift for you. And here is an advice - just type a few lines of code and submit it as soon as possible. A story for this problem is the following. John and Brus were training for the World Finals. They have solved a lot of the problems at acm.lviv.ua.
John: Hey, Brus, have you solved this problem?
Brus: John, leave me alone - I’m sleeping!
You are given the lists of all John’s and Brus’s accepted runs and you have to determine \(X\) — the number of distinct problems solved by at least one of the guys and \(Y\) — the number of distinct problems solved by both of them.
Input
A test case starts with a line containing two integers \(N_J\) and \(N_B\) — the number of John’s accepted runs and the number of Brus’s accepted runs respectively. The next line contains \(N_J\) integers \(J_i\). Here \(J_i\) is the problem number for \(i\)-th John’s accepted run. The following line contains \(N_B\) integers \(B_i\), where \(B_i\) is the problem number for \(i\)-th Brus’s accepted run. All the integers in a single line are separated by single spaces.
Output
Print a single line containing two integers \(X\) and \(Y\) separated by a single space.
Constraints
\(1 \le N_J,~N_B \le 100\),
\(1 \le J_i, B_i \le 10^4\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 5 3 1001 1002 1001 1006 1099 1007 1007 1099 | 5 1 |
| Input (stdin) | Output (stdout) |
|---|---|
| 4 7 1 2 3 4 1 1 1 4 2 2 2 | 4 3 |
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|