Social Icons

twitterfacebookgoogle pluslinkedinrss feedemail

Saturday, August 11, 2012

BUBTPC-1st Problem F - Formula 1


Problem F
Formula 1
Standard Input/Output
Time limit: 2sec.

Problem Description:
            Formula 1” is a famous motor race event held all over the world. Like every famous events it also has a qualifying round before the final event, where all the racers are required to compete in a time trial. After the time trial the best 20 racers are allowed to take part in the final race (although this is not the main scenario, for the simplicity of the problem we took it as 20). But there is also another rule, which says the winner of the previous qualifying round will go to main race although he fails to be in the best 20. So in the very beginning qualifying of the season there must be 20 participants, but next qualifying may contain 21 participants (if the winner of the previous round fails to be in 20). If there are less than 20 contestants then everyone will go to the final race.
            Now Bangladesh has become the new addition of “Formula 1” hosts. As you are one of the best programmers available here your task is to write a program which will take input of qualifying round time of racers and decided how many contestants are going in the final round.
Input:
            The first line of input will contain a number (1<=S<=10), which will denote the number of season. In Each season will contain three line of input. The first line will contain a number N (-1<=N<=100), which represents the winner of the previous qualifying round (if the winner number is -1 then you can assume there is no winner in previous round, that is this is the first round of the season). Then in the second line an integer M (1<=M<=100), will represent the number of contestant. In the third line you will have to input M integer numbers which will represent the time taken by the contestants. Here the first number contains the time taken by 1st racer and second represents the time taken by 2nd racer and so on.
Output:
            You had to produce output for every season. In each season there will be three lines of output. First line will contain the lowest time of the qualifying and the next line will contain the highest time of the qualifying (highest of top 20). In the third line you will have to output the number of racers going to the next round.

Sample Input
Sample Output
2
-1
5
120.00 111.25 110.50 135.00 150.00
2
24
101.10 119.25 101.20 100.05 105.60 103.50 102.40 107.00 120.00 109.20 107.50 109.01 109.00 108.99 100.01 100.00 110.00 105.25 103.20 102.63 105.60 102.40 106.99 99.99
Season 1:
Lowest qualifying time is: 110.50
Highest qualifying time is: 150.00
Number of accepted racer is: 5
Season 2:
Lowest qualifying time is: 99.99
Highest qualifying time is: 119.25
Number of accepted racer is: 21

Hint:
In the sample input first integer 2 means there are 2 seasons to be inputted and we will have to process output for this two season.
Now we will take input of 1st season.
1st number of season 1 is -1, which says there is no winner of previous round. That means this is the first round of the season.
Then the second line contains a number 5 which means there are 5 racers qualifying to go to the final round.
In the final line contains the time of every racer in the qualifying.
Then comes the 2nd season. . . . .


 


“When it seems hard it may have some trick for which it seems hard.
The one, who can find out the trick, can solve it easily!!!”

1 comment:

  1. MGM National Harbor is closing, citing low demand for
    MGM National Harbor 안동 출장마사지 was 진주 출장안마 open to 동해 출장샵 the public Friday after A casino has not been reopened. 여주 출장샵 MGM National Harbor is located in 제천 출장안마 the casino's

    ReplyDelete

 

Sample text

Sample Text