编程介的小学生 2017-07-30 11:37 采纳率: 20.5%
浏览 642
已采纳

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!

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-07-31 15:36
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题