编程介的小学生 2019-08-25 21:51 采纳率: 20.5%
浏览 181

编程序来实现 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!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题