Preparing NOJ

Pythons

1000ms 65536K

Description:

The fish and game commission in South Florida has been catching and measuring

Burmese Pythons in the Everglades. Needless to say, this is a little scary, since these

critters have been rumored to swallow alligators and young computer programmers. The

game officers have been collecting information about their catches, listing the weight in

pounds, along with the date when the snake was caught. Your job is to produce a list of

snakes in ascending order by weight. For any snakes that have the same weight, they

must be listed in ascending order by date.


Input:

The first line contains N, indicating the number of data sets that will follow. For each

dataset, the next line contains S, which indicates the number of snake samples in the

current data set. Then, for each value of S, each of the following lines contain two values:

each Python's weight, followed by the date when the python was caught (in mm/dd/yyyy

order), separated by one space. The dates within each data set are guaranteed to be in

ascending order. Here is a sample dataset:


Output:

For each dataset, display the snake's weight, followed by a single space, followed by the

date when the snake was caught. Display the values in order by weight from lowest to

highest. This is called the primary sort. But for any duplicate weight values, the dates

should be in increasing order. For example, in the following sample output, notice the

specific ordering of the dates for the three snakes weighing 120 pounds. Follow ever data

set with a blank line. Here is a sample that matches the sample input data:


Sample Input:

2
3
85 10/22/2008
66 3/1/2009
76 5/12/2009
6
120 4/10/2009
120 6/5/2009
30 8/21/2009
85 9/2/2009
62 10/22/2009
120 1/12/2010

Sample Output:

66 3/1/2009
76 5/12/2009
85 10/22/2008
By Kip Irvine
30 8/21/2009
62 10/22/2009
85 9/2/2009
120 4/10/2009
120 6/5/2009
120 1/12/2010

Note:

undefined

本题由旧版NOJ导入,来源:Internet

Info

NOJ

Provider NOJ

Code NOJ1387

Tags

Submitted 1

Passed 1

AC Rate 100%

Date 04/20/2019 10:03:10

Related

Nothing Yet