#C10940. Water Fetch Order Processing
Water Fetch Order Processing
Water Fetch Order Processing
You are given a set of orders where each order consists of two positive integers: a fetch time and an arrival time. The task is to group the orders by their fetch time and, for each group, sort the arrival times in increasing order.
More formally, given an integer \(n\) and \(n\) pairs of integers \((T_f, T_a)\), you need to output the results for each distinct fetch time in ascending order. For each fetch time \(T_f\), output a line in the format:
[ T_f: a_1;a_2;\cdots;a_k ]
where \(a_1, a_2, \dots, a_k\) are the arrival times corresponding to that fetch time, sorted in ascending order.
If \(n = 0\), simply output nothing.
inputFormat
The input is read from stdin and has the following format:
- The first line contains a single integer \(n\) denoting the number of orders.
- The following \(n\) lines each contain two integers separated by a space. The first integer is the fetch time \(T_f\) and the second integer is the arrival time \(T_a\).
outputFormat
For each distinct fetch time, sorted in increasing order, print a line to stdout in the following format:
T_f: a_1 a_2 ... a_k
where \(a_1, a_2, ..., a_k\) are the arrival times associated with the fetch time \(T_f\), sorted in ascending order. Each line should be terminated by a newline character.
## sample5
60 5
60 15
120 10
60 25
120 5
60: 5 15 25
120: 5 10
</p>