#T756. 合影效果
合影效果
Description
Xiao Yun and her friends went hiking on Fragrant Hills and were captivated by the beautiful scenery, wanting to take a group photo. If they stand in a row, with all the males on the left (from the photographer's perspective) arranged from shortest to tallest from left to right, and all the females on the right arranged from tallest to shortest from left to right, what would the group photo look like (all individuals have unique heights)?
Input Format
The first line is the number of people, n (2 ≤ n ≤ 40, with at least 1 male and 1 female).
This is followed by n lines, each containing a person's gender (male or female) and height (a floating-point number in meters), separated by a space.
Output Format
Output n floating-point numbers, simulating the heights of each person from left to right in the photographer's view after they have lined up. Each floating-point number should be rounded to two decimal places, with adjacent numbers separated by a single space.
6
male 1.72
male 1.78
female 1.61
male 1.65
female 1.70
female 1.56
1.65 1.72 1.78 1.70 1.61 1.56
Source
CodesOnline