编程介的小学生 2017-10-25 09:48 采纳率: 20.5%
浏览 1023
已采纳

San Guo Sha

问题描述 :

San Guo Sha is a popular Board Game. There are four kinds of cards: identity, role, life and magic card. Today we just regard the identity cards. There are four kinds of identity: Lord(ZG), Loyal minister(ZC), Provocateur(NJ) and Rebel(FZ). To win the game Lord and Loyal minister ‘s goal is make all of Provocateur and rebel dead, Rebel’s goal is make Lord dead, Provocateur’s goal is to be the last survivor. If Load dead and there’s only one Provocateur then he wins (just one Provocateur win), others Rebels win.
Plan

Plan

In the standard contest, there are score rule:(If you know Chinese, could see the second picture)
PlanPlan
The last score equal basic score plus extra score. Now I will tell the identity of everyone and who killed who, please compute everyone’ last score.
输入:

On the first line of input is a single positive integer, 1<=T<=100, specifying the number of test cases to follow.
Each test case begins with 2 integers N , M (4<=N<=100, 0<=M<N). N is the number of players and M is the relation of who kill who.
Then N string on next line("ZG","ZC","FZ","NJ"), specifying each’s identity(begin with 0). I promise each identity will be at least one and there is one and only one ZG.
Then M lines follow, each line with two numbers A B, meaning A killed B.I promise A and B must alive player. If someone was win then you should not deal with the remain instruct.
输出:

On the first line of input is a single positive integer, 1<=T<=100, specifying the number of test cases to follow.
Each test case begins with 2 integers N , M (4<=N<=100, 0<=M<N). N is the number of players and M is the relation of who kill who.
Then N string on next line("ZG","ZC","FZ","NJ"), specifying each’s identity(begin with 0). I promise each identity will be at least one and there is one and only one ZG.
Then M lines follow, each line with two numbers A B, meaning A killed B.I promise A and B must alive player. If someone was win then you should not deal with the remain instruct.
样例输入:

3
4 3
ZG ZC NJ FZ
1 3
2 1
0 2

6 1
ZG ZC NJ FZ FZ FZ
3 0

8 7
ZG ZC ZC NJ NJ FZ FZ FZ
3 1
3 2
3 4
3 5
3 6
3 7
3 0
样例输出:

5 6 4 0
0 0 1 11 9 9
1 0 0 20 0 0 0 0

  • 写回答

1条回答 默认 最新

  • devmiao 2017-11-07 15:02
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料