#P3887. [GDOI2014] 世界杯
[GDOI2014] 世界杯
Description
The 3014 World Cup is about to begin! As the coach of the defending champion, the Chinese national football team, every player under your command is a powerhouse. Figuring out the strongest 11-player lineup is a happy kind of trouble.
As is well known, the 11 players in a football lineup are each assigned to a particular position, which are mainly divided into four types: goalkeeper, defender, midfielder, and forward. There is exactly one goalkeeper, and the number of defenders, midfielders, and forwards depends on the formation you set. A formation is expressed as -- from defenders to forwards, not counting the goalkeeper. For example, a 3-5-2 formation means there are three defenders, five midfielders, and two forwards. Due to fierce competition, each player is trained only for one position, so each person can play only one of the four positions.
As a coach who knows the players’ abilities inside out, you have quantified each player’s overall rating. To better arrange the formations, your coaching team decides to use the following strategy to assign players: first, propose formations in order, representing the first formation, the second formation, …, the -th formation. Then, for each formation, choose from the players not yet selected the best available numbers of goalkeeper(s), defenders, midfielders, and forwards. For example, for the first formation, select from all players; for the second formation, select from all players except those chosen for the first formation; for the third formation, select from all players except those chosen for the first and second formations; and so on.
Now that the formations are fixed, what you need to know is the average overall rating for each formation.
Input Format
The first line contains four integers , representing the number of available goalkeepers, defenders, midfielders, and forwards.
The second line contains integers , representing the overall rating of each goalkeeper.
The third line contains integers , representing the overall rating of each defender.
The fourth line contains integers , representing the overall rating of each midfielder.
The fifth line contains integers , representing the overall rating of each forward.
The sixth line contains an integer , representing the number of formations proposed by the coaching team.
Each of the following lines contains three integers separated by spaces, indicating that the -th formation is the -- formation.
Output Format
Output lines. For the -th formation, output a real number representing the maximum possible average overall rating for that formation, rounded to decimal places.
3 10 12 4
76 60 87
78 84 84 84 81 82 72 51 77 57
85 84 62 87 88 64 81 90 80 66 88 85
65 83 63 79
2
4 5 1
4 4 2
85.64
78.00
Hint
For testdata, , .
For testdata, , , , , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号