SanguoSHA

                                                         SanguoSHA

                                                  Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
                                                           Total Submission(s): 571    Accepted Submission(s): 324

Problem Description
Sanguosha has a singled version. Two players each select N heroes and start fighting. If a hero dies, the next follows. If one player's heroes are all dead, he loses.

There're restraints among heroes. For example, YuJi restricts Zhu Geliang, LuXun restricts DaQiao, ZhangJiao restricts MaChao, WeiYan restricts XiaoQiao.
Today I play with friends. I know the heroes and the restraints.(If opponent's hero restraint my hero, my hero will be beaten, others my hero will beat opponent's hero)
Can you arrange my heroes' order,no matter what order of opponent's heroes, so that I can win the game?
 
Input
The first line is a number T(1<=T<=50), represents the number of case. The next T blocks follow each indicates a case.
The first line is N(3<=N<=6).
The second line has N names(shorter than 20 letter).
The following N lines each contains a restraints. Restraints are given as “k b1 b2 … bk”, which means the opponent's hero restricts my hero b1, b2 … bk. (0<=K<=N)
 
Output
For each case, first line output the number of case with "Yes" or "No". If Yes, output the order of your heroes separate by a space. If there are more than one order, please output the one with minimum lexicographic order.(as shown in the sample output)
 
Sample Input
  
2 3 ZhugeLiang HuangYueying ZhenJi 1 ZhugeLiang 2 HuangYueying ZhenJi 2 ZhugeLiang ZhenJi 4 MaChao YanLiangWenChou YuJin XiaoQiao 2 MaChao XiaoQiao 2 YanLiangWenChou YuJin 1 XiaoQiao 0
 
Sample Output
  
Case 1: No Case 2: Yes MaChao YanLiangWenChou XiaoQiao YuJin
 

Source
根据文档内容,`sanguosha.txt`是由用户`zhugeliang`使用vim创建的。如果创建失败,可能的原因及解决方案如下: ### 可能原因: 1. **用户身份问题**:当前操作不是以`zhugeliang`用户身份进行。 2. **vim编辑器问题**:vim未正确安装或配置。 3. **目录权限问题**:当前工作目录没有足够的权限创建文件。 4. **命令执行错误**:创建文件时使用的命令有误。 ### 解决方案: 1. **确认用户身份**: - 使用`whoami`命令确认当前登录用户是`zhugeliang`。 - 如果不是,请切换到`zhugeliang`用户,命令为 `su - zhugeliang` 或 `sudo su - zhugeliang`。 2. **检查vim安装情况**: - 确认系统已安装vim,可以通过命令`vim --version`来查看版本信息。 - 如果未安装,使用包管理工具安装vim,例如在Ubuntu上使用`sudo apt-get install vim`。 3. **检查目录权限**: - 使用`pwd`命令确认当前工作目录。 - 检查该目录的权限,确保`zhugeliang`有写权限,可以使用`ls -ld /path/to/directory`查看。 - 如果权限不足,可以更改目录权限或选择其他有权限的目录。 4. **重新尝试创建文件**: - 使用正确的命令创建文件,具体步骤如下: ```bash vim sanguosha.txt ``` - 在vim中输入文本后保存退出: - 输入模式下输入文本:“知天易,逆天难;观今夜天象,知天下大事” - 按`Esc`键退出插入模式。 - 输入`:wq`保存并退出。 如果以上方法仍无法解决问题,请提供具体的错误提示信息以便进一步诊断。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值