#P2580. Roll Call Verification
Roll Call Verification
Roll Call Verification
You have been appointed as a special agent by the principal. Every day, you must record his roll call for the chemistry competition students.
The principal will first provide the number of official participants and their correct names. Then, he will perform a roll call. Your task is to verify whether he called the names correctly.
A correct roll call must satisfy that the number of names called equals the number of official names and the set of names called is exactly the same as the set of official names. In other words, the roll call is a permutation of the official list. If both conditions are met, output No Mistake
; otherwise, output Mistake
.
Mathematically, let \( n \) be the number of official names and let \( S \) be the set of official names. Let \( m \) be the number of names called and \( R \) be the multiset of roll call names. The roll call is correct if and only if \( m = n \) and \( R = S \) (each name appears exactly once).
inputFormat
The input will be given in the following format:
- The first line contains an integer \( n \) indicating the number of official students.
- The next \( n \) lines each contain a string representing the official name of a student.
- The following line contains an integer \( m \) representing the number of names the principal called.
- The next \( m \) lines each contain a string representing a name recorded in the roll call.
outputFormat
Output a single line containing No Mistake
if the roll call is exactly a permutation of the official list; otherwise, output Mistake
.
sample
3
Alice
Bob
Charlie
3
Bob
Alice
Charlie
No Mistake