QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#6649. The Most Precious Things in My Mind

Statistiques

The world of this story is divided into three categories, named Weak, Average, and Strong based on certain characteristics. You can think of this as a classification of races or professions.

A turn-based battle has taken place between two teams. You know what both sides did, and now you are expected to reconstruct all the details.

Below are some technical details of this problem.

Characters

A person has the following attributes: "Race", "Level", "Max HP", "Base Attack Index", "Base Defense Index", "Active Skill Level", and "Passive Skill Level". Among these, "Max HP", "Base Attack Index", and "Base Defense Index" are entirely determined by "Race" and "Level". However, for the convenience of input, all information will be provided in this problem. In battle, each person has an "HP". At the start of the battle, "HP" is equal to "Max HP". When "HP" is less than or equal to 0, the person "falls". For the same "Race", "Max HP", "Base Attack Index", and "Base Defense Index" generally increase exponentially with "Level". Each person holds a "Weapon". Details of "Weapons" are given in the next section.

Weapons

"Weapons" have only two attributes: "Weapon Type" and "Weapon Attack Power". All "Weapons" have two attack methods: "Normal Attack" and "Special Attack". Initiating an "Attack" means using either of these two methods. The effect of a "Normal Attack" is independent of the "Weapon Type", but different "Weapon Types" have different "Special Attack" effects. There are three types of "Weapons", called "B", "G", and "M".

Battlefield and Teams

Each side of the battle contains no more than 6 members, lined up from west to east with IDs 5, 3, 1, 2, 4, 6 (if there are fewer than 6 members, the larger IDs are removed). For convenience, the two teams are called "South Team" and "North Team".

Turns

In each "Turn", only one person can "Act". Odd-numbered "Turns" are for members of the "South Team" to "Act", and even-numbered "Turns" are for members of the "North Team" to "Act". In the first "Turn" and the second "Turn", the person who "Acts" is the member with the smallest ID who has not "fallen". In subsequent "Turns", if there is no member in the team with an ID greater than the person who "Acted" last in that team who has not "fallen", then the member with the smallest ID who has not "fallen" in that team "Acts". Otherwise, the member with the smallest ID among those who have an ID greater than the person who "Acted" last in that team and have not "fallen" "Acts". If all members of a team have "fallen", the other team is declared the "Winner".

Actions

There are three types of "Actions". The person "Acting" in the current "Turn" must choose one of the three to complete:

  1. "Normal Attack";
  2. "Special Attack";
  3. "Active Skill".

The effects of these "Actions" will be introduced later. "Special Attack" and "Active Skill" have usage limits, but in this problem, it is guaranteed that all "Actions" are legal, so you do not need to consider this limit.

Damage Calculation

"Damage" refers to the reduction in "HP" caused by a "Normal Attack" or "Special Attack". "Damage", i.e., the amount of "HP" reduction, is determined by the "Attack Intensity" and the "Defense Index" of the person receiving the "Damage".

A person's "Defense Index" is equal to their "Base Defense Index" multiplied by the team's "Defense Bonus". Specifically, if a person receives "Damage" with an "Attack Intensity" of $x$, then this person's "HP" will decrease by $y$, where $y$ is equal to $x$ divided by the person's "Defense Index", rounded down.

"Attack Intensity" is equal to "Base Attack Intensity" multiplied by the "Skill Bonus" of the person initiating the "Attack", multiplied by the team's "Attack Bonus", multiplied by the "Race Counter Bonus", multiplied by the "Orientation Bonus". These concepts will be introduced later.

Normal Attack

Select an enemy member who has not "fallen" as the "Target". The "Target" receives "Damage" with a "Base Attack Intensity" equal to the "Base Attack Index" of the person initiating the "Attack" multiplied by the "Weapon Attack Power".

Special Attack

Select an enemy member who has not "fallen" as the "Target".

There are three types of "Weapons", and the "Special Attack" effects for different "Weapon Types" are as follows:

  • "B": The "Target" receives "Damage" with a "Base Attack Intensity" equal to the "Base Attack Index" of the person initiating the "Attack" multiplied by the "Weapon Attack Power" multiplied by 125%.
  • "G": The "Target" and the nearest one member (if it exists) on both the west and east sides of the "Target" who have not "fallen" each receive "Damage" with a "Base Attack Intensity" equal to the "Base Attack Index" of the person initiating the "Attack" multiplied by the "Weapon Attack Power" multiplied by $x\%$. The value of $x$ is equal to 135 divided by the number of people who will receive "Damage". "Damage" is calculated in the order of "Target", west of "Target", and east of "Target". Note that if someone "falls" during the process, that person's "Passive Skill" will no longer affect the "Damage" calculation for those who follow in the sequence. Specifically, the "Orientation Bonus" for all "Damage" is calculated based on the "Dodge Orientation" of the "Target".
  • "M": The "Target" receives "Damage" with a "Base Attack Intensity" equal to the "Base Attack Index" of the person initiating the "Attack" multiplied by the "Weapon Attack Power" multiplied by 115%. The nearest one member (if it exists) on both the west and east sides of the "Target" who have not "fallen" each receive "Damage" with a "Base Attack Intensity" equal to the "Base Attack Index" of the person initiating the "Attack" multiplied by the "Weapon Attack Power" multiplied by 23%. "Damage" is calculated in the order of "Target", west of "Target", and east of "Target". Note that if someone "falls" during the process, that person's "Passive Skill" will no longer affect the "Damage" calculation for those who follow in the sequence. Specifically, the "Orientation Bonus" for all "Damage" is calculated based on the "Dodge Orientation" of the "Target".

Skills

"Skills" are divided into "Active Skills" and "Passive Skills". Each "Race" has one "Active Skill" and one "Passive Skill". The effect of a "Skill" varies depending on the "Race" and "Skill Level". "Skill Level" is an integer from 0 to 5. A "Skill Level" of 0 means the "Skill" is not possessed.

Using an "Active Skill" requires selecting a person as the "Skill Target".

"Active Skills" are described as follows: (Effects for levels 1 to 5 are separated by slashes; it is guaranteed that the "Active Skill Level" of the person using the "Active Skill" is not 0)

  • "Weak Race": Increases the "HP" of one member of the team who has not "fallen" by the member's "Max HP" multiplied by 10%/12%/15%/17%/20%, rounded down.
  • "Average Race": Select one enemy member who has not "fallen". At the end of the "Turn" of the team using this "Active Skill", their "HP" is reduced by their "Max HP" multiplied by 6%/7%/8%/9%/10%, rounded down. This effect lasts for 3 turns, meaning it triggers 3 times. If the member already has an effect applied by the same type of "Skill" (which may be of a different level), this effect will overwrite the previous one.
  • "Strong Race": Makes the "Skill Bonus" of one member of the team who has not "fallen" become 2.1/2.17/2.24/2.32/2.4.

A member's "Passive Skill" only takes effect when the member has not "fallen"; it no longer takes effect after they have "fallen".

"Passive Skills" are described as follows:

  • "Weak Race": At the start of the team's "Turn", the "HP" of all members of the team who have not "fallen" increases by 1.3%/1.6%/1.9%/2.2%/2.5% of their "Max HP". If multiple members of the team have this "Skill", the values of this effect can be added up to a maximum of 5%. Anything exceeding 5% is calculated as 5%. The amount of "HP" increase needs to be rounded down after the effects are stacked.
  • "Average Race": The team's "Defense Bonus" is initially 1. This skill increases the team's "Defense Bonus" by 0.01/0.02/0.03/0.04/0.05. If multiple members of the team have this "Skill", the values of this effect can be added up to a maximum of 0.1. Anything exceeding 0.1 is calculated as 0.1.
  • "Strong Race": The team's "Attack Bonus" is initially 1. This skill increases the team's "Attack Bonus" by 0.01/0.02/0.03/0.04/0.05. If multiple members of the team have this "Skill", the values of this effect can be added up to a maximum of 0.1. Anything exceeding 0.1 is calculated as 0.1.

When a member's "HP" increases, it cannot exceed the member's "Max HP". If the "HP" after the increase exceeds the "Max HP", the effect of this "HP" increase is changed to setting the member's "HP" to their "Max HP".

Skill Bonus

At the start of the battle, everyone's "Skill Bonus" is 1. Only two ways can change the "Skill Bonus":

  • The "Active Skill" of the "Strong Race". See the description of "Skills".
  • When a person initiates an "Attack" and after all "Damage" from this "Attack" has been calculated, the person's "Skill Bonus" becomes 1.

Race Counter Bonus

The "Race Counter Bonus" is related to the "Race" of the person initiating the "Attack" and the "Race" of the person receiving the "Damage". The values of the "Race Counter Bonus" are shown in the table below:

Initiator / Receiver Weak Average Strong
Weak 1.0 0.9 1.1
Average 1.1 1.0 0.9
Strong 0.9 1.1 1.0

Orientation Bonus

During an "Attack", the side initiating the "Attack" has an "Attack Orientation", and the "Target" of the "Attack" has a "Dodge Orientation". "Attack Orientation" and "Dodge Orientation" are each an integer from 1 to 6. When the "Attack Orientation" is $a$ and the "Dodge Orientation" is $d$, the value of the "Orientation Bonus" is shown in the table below:

$(a - d) \pmod 6$ Orientation Bonus
0 1.25
1 or 5 1.00
2 or 4 0.75
3 0.00

Subtasks

Subtask Constraints
1 $1 \le n, m \le 6$, $1 \le T \le 50000$, Weapon Attack Power $\in [300, 80000]$

Input

Read data from standard input. The first line contains two positive integers $n, m$, representing the number of people in the "South Team" and the "North Team", respectively. The next $n$ lines, where the $i$-th line represents the information of the member with ID $i$ in the "South Team", are in the following format: <Type> Lv=<Lv> maxhp=<maxhp> atk=<atk> def=<def> skillLv=<skillLv> passivesklLv=<passivesklLv> <weapontype> weaponatk=<weaponatk> The content in angle brackets represents a variable. <Type> is one of Weak, Average, or Strong, representing the corresponding "Race". <Lv> is an integer from 1 to 100, representing the member's "Level". <maxhp> is an integer, representing the member's "Max HP". <atk> is a real number, representing the member's "Base Attack Index". <def> is a real number, representing the member's "Base Defense Index". <skillLv> is an integer from 0 to 5, representing the member's "Active Skill Level". <passivesklLv> is an integer from 0 to 5, representing the member's "Passive Skill Level". <weapontype> is one of B, G, or M, representing the corresponding "Weapon Type". <weaponatk> is a real number, representing the member's "Weapon Attack Power". The next $m$ lines, where the $i$-th line represents the information of the member with ID $i$ in the "North Team", follow the same format as the "South Team". The next line contains a positive integer $T$, representing the number of "Turns" performed. The next $T$ lines, where the $i$-th line represents the "Action" of the $i$-th "Turn". The description of an "Action" starts with a string representing the type of "Action". Basicattack target=<target> atkpos=<atkpos> ddgpos=<ddgpos> represents a "Normal Attack". Specialattack target=<target> atkpos=<atkpos> ddgpos=<ddgpos> represents a "Special Attack". Skill target=<target> represents using an "Active Skill". It is guaranteed that the member's "Skill Level" is not 0. Where <target> represents the ID of the "Target" or "Skill Target". If it is an "Active Skill" of the "Weak Race" or "Strong Race", this ID is the ID of a teammate; otherwise, it is the ID of an enemy. <atkpos> is an integer from 1 to 6, representing the "Attack Orientation". <ddgpos> is an integer from 1 to 6, representing the "Dodge Orientation". It is guaranteed that all "Actions" are legal. For convenience, the representation of real numbers in this problem is special. The specific representation is to use the <mag>e<exp> format to represent <mag> multiplied by 10 to the power of <exp>. Where <mag> is a positive integer between 1 and 99999, and <exp> is an integer between -6 and 0. For example, 42.195 can be represented as 42195e-3, 6 can be represented as 6e0 or 600e-2, etc., and 0.04 can be represented as 4e-2, etc.

Output

Output to standard output. For each "Turn", output the information of this "Turn" in chronological order. The format of the information is as follows: <team> <id> recovered +<heal> hp -> <curhp>/<maxhp> represents the "HP" increase caused by the "Skill" of the "Weak Race". If the "HP" was already equal to the "Max HP" before the increase, there is no need to output this line. <team> <id> took <dmg> damage from <atkteam> <atkid> -> <curhp>/<maxhp> represents a member receiving "Damage". <team> <id> took <dmg> damage from skill -> <curhp>/<maxhp> represents the "HP" reduction caused by the "Active Skill" of the "Average Race". <team> <id> applied <type> skill to <targetteam> <targetid> represents using an "Active Skill". Where <team> represents the team name, which is either South or North. <id> represents the ID of the person whose "HP" changed in the team, which is a positive integer from 1 to 6. <heal> represents the amount of "HP" that should have been increased (without considering the "Max HP" limit), which is a positive integer. <curhp> refers to the "HP" after the change, which is a non-negative integer. If the "HP" decreases to below 0, output 0. <maxhp> represents the "Max HP" of the person whose "HP" changed, which is a positive integer. <dmg> is the "Damage" received or the "HP" reduction caused by the "Active Skill" of the "Average Race", which is a non-negative integer. <type> is the "Race" of the person using the "Active Skill", which is one of Weak, Average, or Strong. <atkteam> and <atkid> are the team name and ID of the person initiating the "Attack", formatted the same as <team> and <id>. <targetteam> and <targetid> are the team name and ID of the "Skill Target", formatted the same as <team> and <id>. The chronological order is as follows: At the start of the "Turn", the "Passive Skill" effect of the "Weak Race" may be triggered, output in ascending order of ID. If an "Active Skill" is used, output one line of information about using the "Active Skill". Then output the "HP" change information caused by the "Action". If the "Damage" is 0, it must also be output. If no "Damage" is caused, do not output. If a "Special Attack" changes the "HP" of multiple people, output in the order of "Target", the person to the west of the "Target", and the person to the east of the "Target". At the end of the "Turn", the "Active Skill" effect of the "Average Race" may be triggered, output in ascending order of ID. After each "Turn", output the "HP" information of both teams in the following format: <team>: [<curhp5>/<maxhp5>] [<curhp3>/<maxhp3>] <curhp1>/<maxhp1> [<curhp2>/<maxhp2>] [<curhp4>/<maxhp4>] [<curhp6>/<maxhp6>] Where <team> represents the team name, <curhpi> represents the "HP" of the person with ID $i$ in the team, and <maxhpi> represents the "Max HP" of the person with ID $i$ in the team. There is exactly one space between the "HP" information of two people, and exactly one space between the first "HP" information and the colon. The "HP" information of people who have "fallen" also needs to be output. Square brackets indicate that if a person with ID $i$ does not exist in the team, it is not output. Note that the output here is in positional order rather than ID order, i.e., the order is 5, 3, 1, 2, 4, 6. Output the information of the "North Team" first, then the information of the "South Team". Each "Turn" information ends with an empty line. After all "Turns", if a team has "won", output one line: Team <team> won.. Where <team> is the team name, which is South or North. Because an "Action" requires specifying a person who has not "fallen" as the "Target" or "Skill Target", and all "Actions" are legal, if a team "wins", it must be after the last "Turn". If no team "wins", do not output.

Examples

Input 1

1 2 1
2 Strong Lv=90 maxhp=2451 atk=15588e-4 def=96931e-3 skillLv=5
passivesklLv=5 M weaponatk=80000e0
3 Strong Lv=100 maxhp=3512 atk=16385e-4 def=12511e-2 skillLv=5
passivesklLv=5 G weaponatk=80000e0
4 Weak Lv=1 maxhp=100000 atk=75000e-5 def=10000e-6 skillLv=5
passivesklLv=5 B weaponatk=80000e0
5 3
6 Skill target=2
7 Specialattack target=1 atkpos=3 ddgpos=3
8 Specialattack target=1 atkpos=5 ddgpos=5

Output 1

South 1 applied Strong skill to South 2
North: 100000/100000
South: 2451/2451 3512/3512

South 1 took 1063 damage from North 1 -> 1388/2451
North: 100000/100000
South: 1388/2451 3512/3512

North 1 took 52556526 damage from South 2 -> 0/100000
North: 0/100000
South: 1388/2451 3512/3512

Team South won.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.