编程介的小学生 2019-11-30 22:35 采纳率: 20.5%
浏览 106

Final Combat

Problem Description
You’re playing an RPG, which is arguably the best Chinese RPG in 2007. You got to the final combat. You want to win as soon as possible. Do you know what I am talking about?

For competitors who're not familiar with the game: we're giving a brief introduction to the combat system and the characters involved in that last combat very soon.

For competitors who're too familiar with the game: we're simplifying and/or changing the rules and facts for this problem. We apologize if you feel unhappy about that.

Fig. The final combat

The screenshot above gives you some idea about the combat system and the characters, which can be summarized as follows:

You have 4 heroes: Yun Tianhe (YTH), Han Lingsha (HLS), Liu Mengli (LML) and Murong Ziying (MRZY). Before the combat begins, you need to choose exactly three heroes and rearrange them in some order. Let's call the 1st, 2nd and 3rd hero H1, H2 and H3, respectively. In this screenshot above, H1 is YTH, H2 is HLS and H3 is LML. (Sorry for the Ziying fans!)

There are two bosses: Xuan Xiao (XX) and Su Yao (SY), both in the back of the screenshot.

The goal of this combat is to defeat SY. In this problem, you can assume that XX is immortal, although it's possible to defeat him in the real game.

The key to this problem is to understand the "semi" round-based combat system. See the "progress bar" on the top of the screen? Each hero has a very small progress ball (in light-blue) on the bar, with an icon above the ball. Similarly, each boss also has a ball (in red), but the icon is below the ball. When the combat begins, all the progress balls start moving from the left corner of the bar. When a ball reaches the right corner, the corresponding character is able to act. If more than one character can act, they make actions one by one, according to this precedence order: YTH, HLS, LML, MRZY, XX, SY. When a character is acting, all progress balls stopped moving. After a character finished an action, his/her progress ball is reset to the left corner of the progress bar. When nobody is acting, all progress balls go right simultaneously (but possibly with different speeds, see below).

In this problem, each character has 4 main properties: Jing, Qi, Shen, Su.

Jing means "health". When a character's Jing reaches zero or negative, he/she is defeated. A character's maximum Jing is denoted by parameter maxjing.

Qi means "vitality". It is used by special-skill attacks. When Qi is not enough, certain special-skill attacks cannot be performed. A character's maximum Qi is always 100.

Shen means "spirit". It is used by Xian Shu (something similar to, but more amazing than "magic"). When Shen is not enough, certain Xian Shu cannot be performed. A character's maximum Shen is denoted by parameter maxshen.

Su means "speed". It affects how quick a character's progress ball moves. Su is always a positive integer less than 5. If a character's Su is x, it takes 5-x units time for his/her progress ball to move from left corner to the right corner of the progress bar. A character's Su (which is never changed during the combat) is denoted by parameter su.

For simplicity, you may assume that both XX and SY use the same strategy:

In his/her (4n+1)-th action (n=0,1,2,...), make a weapon attack upon H1.

In his/her (4n+2)-th action (n=0,1,2,...), make a weapon attack upon H2.

In his/her (4n+3)-th action (n=0,1,2,...), make a weapon attack upon H3.

In his/her (4n+4)-th action (n=0,1,2,...), make a special-skill attack upon all the heroes.

Now we introduce four more parameters for each hero. The first two, d1x and d2x, are the damages that the hero takes on XX's weapon attack and special-skill attack, respectively. For SY's attacks, we define d1s and d2s similarly.

You’re very tired, so you don't want to waste your time designing complex tactics. When a hero is about to act, you only consider the following actions:

Make a physical weapon attack upon either XX or SY (cannot attack both). Be warned though, SY is surrounded by swords (see the screenshot), so making weapon attacks upon her would hurt the attacker himself/herself. The amount of "reflection damage" that the attacker takes is the same as the "physical damage" that SY takes. Attacking XX (yes, you can do that, if you like) does not suffer from physical reflection.

Use Xian Shu to recover Jing. To make your brain easier, you decided not to recover other heroes' Jing. In this problem, the only Xian Shu that you can use is called "Yu Run", which recovers yurun_jing points of Jing (if the resulting Jing exceeds his/her maximum Jing, it is reduced to the maximum) and uses yurun_shen points of Shen.

Use items to recover Shen. To make your brain easier, you decided not to recover other heroes' Shen. In this problem, the only item that you can use is called "Shu Er Guo", which recovers shuerguo_shen points of Shen (if the resulting Shen exceeds his/her maximum Shen, it is reduced to the maximum). You have an infinite number of Shu Er Guo.

Make a special-skill attack if his/her Qi is enough. Each hero has exactly one special-skill attack, attacking both XX and SY. Note that some special-skill attacks are physical. Using a physical special-skill attack makes you take the same damage as SY, just like weapon attacks.

Now it's time to introduce four more parameters for each hero: wad, ssd, ssq and ssp. The number of Jing points that SY takes by the hero's weapon attacks and special-skill attacks are denoted by wad and ssd, respectively. The special-skill attack is physical if and only if ssp=1 (otherwise, ssp=0). It needs ssq points of Qi.

As you may have noticed, Qi cannot be recovered by Xian Shu or items. There are only two ways to increase Qi: make a weapon attack, or get hit by a weapon attack. Being hurt by physical reflection does not earn you extra Qi.

So here come the last two parameters for each hero: q1 and q2, that means making a weapon attack increases q1 points of Qi (whether or not you're reflected), while getting hit by a weapon attack increases q2 points of Qi. If the resulting Qi exceeds his/her maximum Qi (which is always 100), it is reduced to the maximum. Again, performing a special-skill attack never increases your Qi. Getting hurt by the bosses' special-skill attacks never increases your Qi, either.

As a perfectionist, you don't want any hero to be defeated even temporarily (in the real game you can rebirth a hero with certain Xian Shu or items) - for example, it's not allowed to make YTH and SY defeated at the same time (it can happen, for example, after YTH has performed a powerful physical special-skill attack).

Finally comes the question: what is the earliest time (we only care about ball-moving time, not including time needed to make attacks) that you can win the combat, if you play optimally? To play optimally, you need to choose between the options listed above, for each act. It's not as easy as it sounds. Be careful!

Input
There will be at most 100 test cases. Each case begins with 6 positive integers, SY_jing (SY's initial Jing), XX_su (XX's Su), SY_su (SY's Su), yurun_jing, yurun_shen and shuerguo_shen. The next four lines contain descriptions of YTH, HLS, LML and MRZY, in this order. Each line contains 16 non-negative integers: maxjing, maxshen, su, d1x, d2x, d1s, d2s, wad, ssd, ssq, ssp, q1, q2, jing, qi, shen. The last three parameters are the initial Jing, Qi and Shen values of this hero before the combat begins. The limits of most parameters are listed below:

And finally, 1 <= jing <= maxjing, 0 <= qi <= 100, 0 <= shen <= maxshen. The last test case is followed by 6 zeros, which should not be processed.

Output
For each test case, print the earliest time that you can win, and all possible orderings to achieve this. Each ordering is expressed as the concatenation of the first letters of H1, H2 and H3's names. For example, if H1=HLS, H2=LML, H3=YTH, the ordering is expressed as HLY. The orderings should be sorted in increasing order lexicographically. If you can't win the combat within 12 units of ball-moving time, print -1. Print a blank line after the output of each test case.

Sample Input
1000 1 1 200 15 75
1000 100 1 2000 2000 2000 2000 300 800 20 0 5 5
900 10 100
1000 100 1 2000 2000 2000 2000 120 300 10 0 5 5
100 80 100
1000 100 1 2000 2000 2000 2000 100 400 30 1 5 5
450 40 100
1000 100 1 2000 2000 2000 2000 250 700 10 1 5 5
600 50 100
3000 4 1 800 15 75
2000 100 3 2 2 2 2 1 1 1 0 2 1 1000 100 100
2000 100 4 2 2 2 2 1 1000 25 0 2 1 1 1 100
2000 100 1 2 2 2 2 1 1000 1 1 1 1 300 100 0
2000 100 3 2 2 2 2 1 1000 30 0 5 1 1 6 100
26399 3 2 3182 543 800
4462 353 2 4300 4875 6856 5527 31497 5633 61 0 68
63 4355 0 351
5444 300 3 7682 1037 597 4214 6744 6861 68 0 65 12
2136 32 143
5875 705 2 2097 118 2366 978 14276 24850 48 0 55
70 3562 40 277
6413 33 1 6305 1898 340 5238 13989 25287 25 1 72
34 3176 4 30
0 0 0 0 0 0

Sample Output
Case 1: 4 HLY HYL LHY LYH YHL YLH

Case 2: 12 HML

Case 3: -1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
    • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
    • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
    • ¥30 3天&7天&&15天&销量如何统计同一行
    • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
    • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
    • ¥15 vs2019中数据导出问题
    • ¥20 云服务Linux系统TCP-MSS值修改?
    • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
    • ¥20 怎么在stm32门禁成品上增加查询记录功能