#K16311. Pairing Fighters
Pairing Fighters
Pairing Fighters
You are given an integer N representing the number of fighters in a tournament along with a list of integers indicating their skill levels. In the first round, the fighters are paired after sorting their skill levels in non-decreasing order.
If N is odd, the last fighter does not get paired. The number of pairs formed is given by the floor function:
$P = \lfloor N/2 \rfloor$
Your task is to output a tuple (P, P)
, where both the total number of pairs and the number of distinct pairs equal P.
inputFormat
The input is read from standard input (stdin) and consists of two lines:
- The first line contains a single integer N, the number of fighters.
- The second line contains N space-separated integers representing the skill levels of the fighters.
outputFormat
Output to standard output (stdout) a single line with two space-separated integers:
- The total number of pairs formed in the first round.
- The number of distinct pairs (which is the same as the total number of pairs in this case).
In other words, if P = \lfloor N/2 \rfloor, then you should output: P P
.
7
5 3 8 6 1 9 2
3 3
</p>