San Guo Sha

三国杀游戏得分计算
Problem Description
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.
 In the standard contest, there are score rule:(If you know Chinese, could see the second picture)
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.
 

Input
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.
 

Output
Please output the everyone's last score in a line, n integers separate by a empty.
 

Sample Input
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
 

Sample Output
5 6 4 0 0 0 1 11 9 9 1 0 0 20 0 0 0 0
 
太欺负人了,第一欺负姐姐没玩儿过三国杀,第二欺负姐姐不懂什么叫“单挑!”
所谓“单挑”,就是说——必须有一个主公,忠臣有没有无所谓,内奸一个,没有反贼!
害我WA了不知道多少次!心痛……
 
拼音数据(无声调):a ai an ang ao ba bai ban bang bao bei ben beng bi bian biao bie bin bing bo bu ca cai can cang cao ce cen ceng cha chai chan chang chao che chen cheng chi chong chou chu chua chuai chuan chuang chui chun chuo ci cong cou cu cuan cui cun cuo da dai dan dang dao de den dei deng di dia dian diao die ding diu dong dou du duan dui dun duo e ei en eng er fa fan fang fei fen feng fo fou fu ga gai gan gang gao ge gei gen geng gong gou gu gua guai guan guang gui gun guo ha hai han hang hao he hei hen heng hong hou hu hua huai huan huang hui hun huo ji jia jian jiang jiao jie jin jing jiong jiu ju juan jue jun ka kai kan kang kao ke ken keng kong kou ku kua kuai kuan kuang kui kun kuo la lai lan lang lao le lei leng li lia lian liang liao lie lin ling liu long lou lu lü luan lue lüe lun luo ma mai man mang mao me mei men meng mi mian miao mie min ming miu mo mou mu na nai nan nang nao ne nei nen neng ng ni nian niang niao nie nin ning niu nong nou nu nü nuan nüe nuo nun ou pa pai pan pang pao pei pen peng pi pian piao pie pin ping po pou pu qi qia qian qiang qiao qie qin qing qiong qiu qu quan que qun ran rang rao re ren reng ri rong rou ru ruan rui run ruo sa sai san sang sao se sen seng sha shai shan shang shao she shei shen sheng shi shou shu shua shuai shuan shuang shui shun shuo si song sou su suan sui sun suo ta tai tan tang tao te teng ti tian tiao tie ting tong tou tu tuan tui tun tuo 定义数据集:采用字符模型,因此一个字符为一个样本。每个样本采用one-hot编码。 样本是时间相关的,分别实现序列的随机采样和序列的顺序划分 标签Y与X同形状,但时间超前1 准备数据:一次梯度更新使用的数据形状为:(时间步,Batch,类别数) 实现基本循环神经网络模型 循环单元为nn.RNN或GRU 输出层的全连接使用RNN所有时间步的输出 隐状态初始值为0 测试前向传播 如果采用顺序划分,需梯度截断 训练:损失函数为平均交叉熵 预测:给定一个前缀,进行单步预测和K步预测
05-26
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值