编程介的小学生 2017-10-29 12:59 采纳率: 20.5%
浏览 744
已采纳

Football Manager

Problem Description
Football Manager is a series of football management simulation games developed by Sports Interactive and published by Sega. In this game, you will play a role of a football club manager and conduct your team to chase championship titles. As a football team manager, you need to take responsibilities for tactics developing, training arrangements, on-pitch commanding, player trading, etc. One of the most important things is to select your starting line-up.

According to the rules of football matches, there should be 11 players in your starting line-up, where one of them must be a goalkeeper. Besides the goalkeeper (GK), there’re three classes of positions: defender (DF), midfielder (MF), and striker (ST).

When a manager is selecting his starting line-up, he usually determines the formation first. The football formation is usually noted like “4-4-2”“4-5-1”“4-3- 3”, etc. For example, the “4-5-1” formation denotes that there are 4 defenders, 5 midfielders and 1 striker. Note that every player has his preferred positions, and they will always refuse to appear at positions he does not prefer, while some excellent players may be qualified for several positions. For example, C. Ronaldo can play as both a striker and a midfielder.

In the game, players have two important attributes for each of his preferred positions: CA (current ability) and PA (potential ability). The CA of the line-up is defined as the sum of the 11 players’ CA in the formation. Similar to CA, the PA of the line-up equals to the sum of 11 players’ PA. Then your task is to select the proper players to reach maximum CA of your line-up. When a tie occurs, the one of maximum PA is required.

Beyond these requirements and limits, the relationships between players also make sense to the CA of your line-up. Every player may like or dislike some of his teammates. When he and the one he likes are both on the pitch, the CA of the line-up will be increased by a specific value. On the contrary, when someone and his disliked player occurs on the pitch concurrently, the line-up’s CA will be decreased. Be careful that the like and dislike relationships between players are unidirectional. Not surprisingly, Plane.Gao likes Messi very much while Messi may not know Plane.Gao at all.

Input
The input contains multiple test cases. The first line of input gives the number of test cases T (1<=T<=20).

For each test case, the first line contains an integer N (1<=N<=20), the total number of players in your team.

Each of the following N lines describe a player in the following format:
. . .
Here:
denotes the player’s unique squad number (between 1 and 99, inclusive).
denotes the number of positions he preferred.
. . . are strings chosen in {GK, DF, MF, ST},denoting all his preferred positions.
denotes his CA at .
denotes his PA at .
(0<=|P Ai|,|C Ai|<=1000,note P A and CA can be negative here.)
After the description of the player list, the following line will give an integer M (0<=M<=N (N - 1)), which indicates the number of relationships between the teammates. Then each of the following M lines is shown in the following format:
Like/Dislike
Here:
denotes Player A’s Squad Number.
denotes Player B’s Squad Number.
Like/Dislike denotes the property of the relationship.
denotes that when both of them appear in your starting line-up, the CA of line-up will be increased/decreased by value(0<=value<=100).
No two relationships of the same pair of teammates will occur.
The last line of each test case shows the formation that you have determined. We guarantee that the formation is legal.
You may take the sample for more details.

Output
For each test case, you should output two integers in a line, the best CA and PA of your line-up. If you can even not round up your line-up, please output “Poor Manager!” (without quotes)

Sample Input
2
15
1 1 GK 150 160
2 1 DF 150 160
3 1 DF 150 160
4 1 DF 150 160
5 1 DF 150 160
6 1 MF 150 160
7 1 MF 150 160
8 1 MF 150 160
9 1 ST 150 160
10 1 MF 150 160
11 1 ST 150 160
12 1 GK 130 150
13 1 DF 130 150
14 1 MF 130 150
15 1 ST 130 150
2
15 9 Like 10
2 13 Dislike 20
4-4-2

11
1 1 GK 150 160
2 1 DF 150 160
3 1 DF 150 160
4 1 DF 150 160
5 1 DF 150 160
6 1 MF 150 160
7 1 MF 150 160
8 1 MF 150 160
9 1 ST 150 160
10 1 MF 150 160
11 1 ST 150 160
0
4-3-3

Sample Output
1650 1760
Poor Manager!

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-19 08:45
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器