Problem M
In Flagrante Delicto
“[There] is a reason why the most successful trial lawyers are often master storytellers, making their cases come to life for their jurors.” –G. Christopher Ritter.
A good lawyer can take an incomplete set of facts and turn it into a convincing story.
Last night, a major robbery occurred at a bank, and, luckily, the robber seems to have been successfully arrested. Unfortunately, it is neither clear what the order of events was, nor whether the man they caught is even really the right guy. It is necessary to reconstruct the correct order of events to convince the jury that the accused is guilty beyond reasonable doubt for a conviction to be reached.
It is known that there are
Define a consistent recollection as a
subset of the
-
the minimum
such that there is some consistent recollection of events where it is possible to determine for sure who is right, and -
the minimum
such that for any consistent recollection of events, it is possible to determine for sure who is right.
By finding these numbers, you can help the prosecution estimate the minimum amount of evidence they need to make their case, and the minimum amount of evidence they need to make their case foolproof. (Or determine that the man they have is really innocent.) Please help!
Input
The first line of input contains a single integer
The second line of input contains
The third line of input contains
It is guaranteed that the prosecution and defense do not
claim the exact same order of events; that is, there exists
some
Output
Output two integers on a single line, the minimum values of
Sample Input 1 | Sample Output 1 |
---|---|
4 3 2 4 1 1 3 4 2 |
2 3 |
Sample Input 2 | Sample Output 2 |
---|---|
2 1 2 2 1 |
2 2 |