#P7610. [THUPC 2021] 群星连结
[THUPC 2021] 群星连结
Description
Basic Parameters
First, before the game starts, each player must choose exactly characters and number them .
Each character has some basic parameters:
- :maximum HP, current HP;
- :maximum energy, current energy;
- :base attack, attack bonus;
- :base defense, defense bonus;
In addition, for convenience, let and .
At the start of the game, current HP equals maximum HP , and current energy , attack bonus , and defense bonus are all .
are given in the input.
Besides, each character has one talent and one skill, described in the Talent section and the Skill section.
Death Check
At any time during the game, if a character’s current HP drops to or below, then that character is considered dead.
Once a character is considered dead, it completely leaves the battlefield. Its HP is fixed at , and it cannot regain HP in any way (i.e. it cannot be revived, even if it has Talent — Mind Over Matter; also, it cannot be healed by skills from other allies). It cannot perform normal attacks or cast skills, and it cannot be selected as a priority target, so it cannot be hit by normal attacks either.
In short, it does not participate in the rest of the game in any form. In this problem, all phrases like “all”, “all characters”, etc. do not include dead characters.
When all characters on one side are considered dead, the game ends immediately and the other side wins (if there are still unresolved effects at this moment, none of them will be processed).
Parameter Overflow
At any time during the game, if a character has , then immediately becomes .
At any time during the game, if a character has , then immediately becomes .
Priority Target
Before the game starts, each player must specify an attack order for each character.
Specifically, for character , you must determine an attack order , where is a permutation of .
At any time during the game, the priority target of character is if and only if are all dead, and is not dead.
Normal Attack
A normal attack deals damage to the priority target.
A character with Talent — Transcendence will instead deal true damage to the priority target. See the Talent section.
A character with Talent — Stellar Power Projection will add true damage to its normal attack. See the Talent section.
Talent
Talents have the following types (the number at the start of each line is the talent type ID, and the parentheses () contain extra parameters):
- Talent — I Shut Down: This character’s talent has no effect;
- Talent — Flesh and Blood: This character is immune to half of true damage. See the HP Deduction Phase section for details.
True damage is described in the HP Deduction section; - Talent — Stellar Power Projection : Each normal attack by this character additionally deals true damage;
- Talent — Mind Over Matter : After each allied action ends, this character restores HP and additionally restores energy;
- Talent — Transcendence: This character’s normal attack is treated as a true-damage attack; i.e. its normal attack deals no damage, but deals true damage;
- Talent — Technology Above All : After each normal attack, this character restores HP; after each skill cast, this character additionally restores energy. Note: if the normal attack or skill cast causes all enemy characters to become dead, then this character will no longer restore HP or energy.
This problem guarantees that all extra talent parameters are positive integers (but they may be in the input; see the Input Format section for details).
Skill
When a character’s energy equals its maximum energy (and the character is selected to cast a skill during the game), it may clear its energy to and cast one skill.
Skills have the following types (the number at the start of each line is the skill type ID, and the parentheses () contain extra parameters):
- Skill: Mind Broken! This character’s active skill has no effect. Note: the skill can still be cast, it just has no effect.
- Skill: Green Explosion! Deal damage to all enemy characters, then reduce the energy of all enemy characters by , where is that enemy character’s current energy (i.e. for each enemy character, if its current energy is , then after this skill it becomes $mp_{enemy}-\left\lfloor\frac{mp_{enemy}}{10}\right\rfloor$). Note: by the rules, enemy characters first take damage and enter the HP Deduction Phase, restoring energy in that phase, and only then have their energy reduced by this skill.
- Skill: Sun (zhou) Rise (ji) (dao) Rain (dan)! Deal true damage to all enemy characters.
- Skill: Heavenly Tower Overlord Severing Sword! Deal $\min\left(\left\lfloor\frac{HP_{enemy}}{10}\right\rfloor,x\times A\right)$ damage to all enemy targets, where is the target’s maximum HP.
- Skill: The Show Begins! Let the current round be round . From the moment this skill is cast until the end of round , at the end of each allied action, all allied characters additionally restore energy.
- Skill: Heavenly Wolf Devouring Slash! Decrease the priority target’s defense bonus by , then deal true damage to the priority target.
- Skill: Earth (Too) Blue (Void) Azure (Blue) Flash (Flash) Lightning! Deal true damage to the priority target. Also, let the current round be round . From the moment this skill is cast until the end of round , decrease all enemy characters’ attack bonus by .
- Skill: Aurora Bloom! Make exactly one allied character (not dead) with the lowest current HP (if multiple, choose the smallest index) restore HP. Also, let the current round be round . From the moment this skill is cast until the end of round , increase all allied characters’ attack bonus by .
- Skill: Meteor! Deal damage to all enemy characters. Let the current round be round . After this skill deals damage, until the end of round , decrease all enemy characters’ defense bonus by . Note: this skill deals damage first, then applies the debuff.
- Skill: Elf’s Blessing! All allied characters restore HP. Let the current round be round . From the moment this skill is cast until the end of round , increase all allied characters’ defense bonus by .
- Skill: Full Power Ultra Full Burst! The End of Samsara! All allied characters’ base attack and base defense become twice their original values, i.e. ; for characters not dead, current HP becomes $\max\left(\left\lfloor\frac{HP}2\right\rfloor,hp\right)$, and current energy becomes $\max\left(\left\lfloor\frac{MP}2\right\rfloor,mp\right)$; let the current round be round . From the moment this skill is cast until the end of round , at the end of each allied action, all allied characters additionally restore energy. At the end of round , if the enemy still has any character not dead, then all allied characters are forced to have their HP cleared to and are considered dead. In addition, when this skill is cast, all characters on the field that have this skill (including itself) will have their skill forcibly replaced with skill ID , Skill: Mind Broken! (therefore this skill can be cast at most once in the game).
This problem guarantees that all extra skill parameters are positive integers (but they may be in the input; see the Input section for details).
Note: effects of the form “let the current round be , then from casting this skill until the end of round , …” can stack.
HP Recovery and Energy Recovery
HP can only be restored through talents and skills.
At the end of each allied action, all allied characters gain energy. Characters with Talent — Mind Over Matter, and characters affected by Skill: The Show Begins! and Skill: Full Power Ultra Full Burst! The End of Samsara!, can gain extra energy.
After an allied character performs a normal attack or casts a skill, that character gains energy. Characters with Talent — Technology Above All gain extra energy after casting a skill.
Note: when casting a skill, first clear all energy, then cast the skill, then increase energy.
In particular, if the skill is Skill: Full Power Ultra Full Burst! The End of Samsara!, then after setting the caster’s $mp=\max\left(mp,\left\lfloor\frac{MP}2\right\rfloor\right)$, increase energy.
When an allied character enters the HP Deduction Phase due to taking damage, that character gains energy (regardless of whether it actually loses HP).
HP deduction is described in the HP Deduction Phase section.
HP Deduction Phase
When a character takes damage or true damage, it immediately enters the HP Deduction Phase (note that even if it takes damage, it still enters the HP Deduction Phase).
After entering the HP Deduction Phase, according to the energy recovery rules, its energy increases by .
Suppose it takes damage and true damage, then:
- If it is immune to half of true damage due to Talent — Flesh and Blood, then its HP is reduced by .
- Otherwise, its HP is reduced by .
Game Process
After the game starts, it can be viewed as several rounds, numbered starting from .
Each round can be divided into the following phases: Alice’s action (during), end of Alice’s action, Bob’s action (during), end of Bob’s action, end of the current round.
During an allied action,
- If there exists at least one allied character that can cast a skill, then choose one to cast a skill in decreasing order of skill ID. If multiple characters can cast the same highest-ID skill, choose the character with the largest character index among them to cast the skill.
- If no allied character can cast a skill, then choose one character whose priority target currently has the highest HP to perform a normal attack. If multiple characters have priority targets with the highest HP, choose the character that would deduct more HP from its priority target (not the one that would deal more damage). If there are still multiple choices, choose the one with the largest character index to perform a normal attack.
Then the allied action ends.
Note: during an allied action, you can only choose one character to cast a skill, or choose one character to perform a normal attack.
Input Format
The first line contains a positive integer , meaning Alice and Bob each have characters.
The next lines describe Alice’s character from line to line .
In these four lines:
- Line 1: four non-negative integers , representing the character’s maximum HP, maximum energy, base attack, and base defense, with guaranteed.
- Line 2: positive integers , representing the character’s attack order, guaranteed to be a permutation of to .
- Line 3: three non-negative integers , representing the talent ID and extra parameters. If this talent has fewer than two extra parameters, you may ignore the extra parts (it is guaranteed that these extra parts are in the input).
- Line 4: four non-negative integers , representing the skill ID and extra parameters. If this skill has fewer than three extra parameters, you may ignore the extra parts (it is guaranteed that these extra parts are in the input).
The next lines describe Bob’s characters in the same format.
Output Format
If the game can end with one side winning, then:
- Line 1: output a positive integer , meaning the game ends in round .
- Line 2: output a string (
AliceorBob) indicating the winner. - Line 3: output non-negative integers, in order, representing each of the winner’s characters’ at the end of the game; output if the character is dead.
If the game will never end or the two sides draw, output any cute emoticon.
3
2 8 1 1
1 2 3
3 1 1
7 2 1 2
6 6 3 0
1 2 3
5 1 1
7 2 1 1
99 10 1 1
2 1 3
1 0 0
10 10 0 0
9 10 1 0
1 2 3
2 1 0
8 2 1 0
8 7 2 1
2 1 3
1 0 0
4 2 1 0
99 10 2 0
2 1 3
1 0 0
10 10 0 0
15
Alice
2 0 96
Hint
【Constraints】
, , .
It is guaranteed that at any time during the game, the absolute value of every parameter and expression mentioned in the statement does not exceed .
It is guaranteed that the game ends within rounds.
【Source】
From the 2021 Tsinghua University Programming Contest and Collegiate Invitational (THUPC2021).
Resources such as editorials can be found at https://github.com/yylidiw/thupc_2/tree/master.
Translated by ChatGPT 5
京公网安备 11011102002149号