Programming contests

ECN programozó csapatverseny, 2022. május 28.

May 28, 2022, 10:15 AM – May 28, 2022, 3:15 PM

Supervising the National Elections

The secret service of Landia has been empowered to supervise the national elections. The secret service uses its own database of electors, which is described as follows (standard input):

  • on the first line, the number of electors n (n ≤ 150 000);
  • on the next n lines, personal code (31-bit positive integer) and name (≤ 27 characters including white space) of electors.

Following the end of this list, the standard input includes an unspecified number (≤ 200 000) of personal codes of those who want to vote. Beware: some persons are not registered (personal code not found in the first list), and some registered persons try to vote twice.

We guarantee that: if a person is not registered, it appears only once in the second list; if a registered person wants to vote many times, it appears only twice in the second list.

Every line of the second list includes an arbitrary number of codes, separated by white spaces.

After the end of elections, the secret service publishes the following statistics (standard output):

  • presence at the election process (number and percent related to the number of electors);
  • number of notregistered persons;
  • frauds (number and percent related to the presence).

The list of shame (fraudulent persons, ≤ 20) is also published, alphabetically ordered.

Sample Input

  1. 5
  2. 32 Tamp Ken
  3. 16 Kong Kim
  4. 20 Tram Tim
  5. 45 Endo Joe
  6. 11 Faro Mia
  7. 10 21 20 11
  8. 32 20 32 16
download as text file

Output for Sample Input

  1. Presence: 4 80.00%
  2. Not registered: 2
  3. Frauds: 2 50.00%
  4. 32 Tamp Ken
  5. 20 Tram Tim
download as text file

Explanation

The codes 10 and 21 are not found in the first list (not registered). Four registered persons were present (20, 11, 32, 16). Two of them (20, 32) tried to vote twice (fraudulent).

University of Debrecen; Faculty of Informatics; v. 09/30/2024