Given a list of people described by an identifier and a name, you must count three things:
Repetitions: number of pairs of persons with the same identifier and the same name.
Conflicts: number of pairs of persons with the same identifier and different name.
Coincidences: number of pairs of persons with a different identifier but the same name.
The input consists of several cases. Each case starts with a positive natural in a separate line, which is the number of people. After that come lines, each one with a natural number and a string, which are the identifier and name of a person. At the end there is a blank line.
For each case, the output has three natural numbers in one line, the number of repetitions, conflicts and coincidences in the list of people at the input.
Evaluation over 10 points:
Slow solution: 5 points.
Fast solution: 10 points.
It is understood that a fast solution is correct, with cost and passes all test cases, both public and private. A slow solution is defined as one that is not fast, but it is correct and passes the public test cases.
Author: PRO1
Generation: 2026-01-25T16:01:43.655Z
© Jutge.org, 2006–2026.
https://jutge.org