2518 - I2P(II)2022_Kuo_mid2(Online) Scoreboard

Time

2022/05/10 19:00:00 2022/05/10 21:20:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13480 Animal World - Natural Selection
13529 Twenty One - 2022midterm

13480 - Animal World - Natural Selection   

Description

There are some animals consisting of cats, fish, birds, and humans in a beautiful world.

 

Whenever an animal's HP turns into 0 or negative, it becomes dead and you should print "<its name> dead" right away.

 

You have to perform the following operations:

  • Birth <name> <species>
    • An animal with name <name>, species <species>, and HP 10 is born.
    • Print "<name> birth" right away.
    • (Note that the animals will be numbered by the order they are born.)
  • Birthsick <name> <species> <HP>
    • An animal with name <name>, species <species>, and HP <HP> is born.
    • Print "<name> birth" right away.
    • It is guaranteed that <HP> is positive and not more than 10.
    • (Note that the animals will be numbered by the order they are born.)
  • Infromation <i>  
    • If the i-th animal is alive, print its name, species, and HP.
  • Talk <i> 
    • If the i-th animal is alive and 
      • cat, print "Meow".
      • fish, print "?".
      • bird, print "Suba".
      • human, print "Hello, world".
  • Sleep <i> <x>
    • If the i-th animal is alive and its HP is less than or equal to 100, multiply its HP by x.
    • (Note that its HP may become larger than 100 after this operation.)
  • Work <i> <x>
    • If the i-th animal is alive, decrease its HP by x.
    • (Note that it may become dead after this operation.)
  • Eat <i> <j>
    • If the i-th animal and the j-th animal are both alive and
      • if the i-th animal is cat and the j-th animal is fish,
      • or the i-th animal is bird and the j-th animal is fish,
      • or the i-th animal is human and the j-th animal is fish or bird,
        • then increase the HP of the i-th animal by the HP of the j-th animal
        • and turn the HP of the j-th animal into 0 (which means the j-th animal dies).
      • If the i-th animal is human and the j-th animal is cat,
        • then turn the HP of the i-th animal into 0 (which means the i-th animal dies).
      • Otherwise, do nothing. 
  • Eatfood <i> <x>
    • If the i-th animal is alive, increase the HP of the i-th animal by <x>.
  • Kill <i> <j>
    • If i ≠ j and the i-th animal and the j-th animal are both alive and of the same kind
      • then turn the HP of the j-th animal into 0 (which means the j-th animal dies).

 

(Note that Birth and Birthsick share the same method name in function.h.)

(Note that Eat and Eatfood share the same method name in function.h.)

 

Input

The first line of the input contains a number Q — the number of operations.

The next Q lines is one of the operations described in the statement.

 

Q ≤ 400000

1 ≤ x ≤ 10 in operation Sleep, Work, and Eatfood.

The time limit is 3sec.

 

  • In test 1 and 2, the operations consists of Birth and Informatoin.
  • In test 3 and 4, the operations consists of Birth, Information, Talk, Sleep, Work, and Eat.
  • In test 5 and 6, the operations consists of Birth, Birthsick, Information, Talk, Sleep, Work, Eat, Eatfood, and Kill.

Animals may die in test 3, 4, 5, and 6.

 

Output

Whenever there's an operation "Birth <name> <species>", print "<name> birth".

Whenever there's an operation "Birth <name> <species> <HP>", print "<name> birth".

Whenever there's an operation "Infromation <i>", print the name, species and HP of the i-th animal.

Whenever there's an operation "Talk <i>", print the corresponding sentences according to the problem statement.

Whenever an animal becomes dead, print "<its name> dead".

Remember to print '\n' at the end of each line.

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

13480.cpp

Partial Judge Header

13480.h

Tags




Discuss




13529 - Twenty One - 2022midterm   

Description

After watching the movie 21, JN is curious about casino.

There are one banker and one guard in the casino. They have banker_ski and guard_ski skill respectively.

There are players playing twenty one. The i-th of them has mi dollars and skii skill.

 

There will be rounds of twenty one in total today.

In each round, each of the players place their bets beti first, then draw some cards.

The banker draws the cards last.

Let A be the sum of the i-th player's cards, B be the sum of the banker's.

Then:

  1. A > 21 and B > 21, nothing happens.
  2. A <= 21 and (B > 21 or A > B), the i-th player wins.
  3. B <= 21 and (A > 21 or B >= A), the i-th player loses.

 

For the banker:

  • If the i-th player wins, the banker has to pay beti dollars to the i-th player.
  • If the i-th player wins and skii < banker_ski, the banker has to pay the i-th player 10 * (the sum of the i-th player's cards) as a bonus.
  • Furthermore, if the i-th player wins and the sum of the i-th player's cards is equal to 21, the banker has to pay 2*(bets + bonus) to the i-th player. (bonus may be equal to 0)
  • For example, if the sum of the i-th player's cards is 21, skii < banker_ski, and beti = 1000, then the banker has to pay (1000+10*21)*2 to the i-th player.
  • Whenever a player becomes bankrupt, the banker calls the guard to kick the player out and gives the guard 100 dollars.
  • Whenever a player is seen to be a cheater; that is, 2*skii < the amount of money that the banker has to pay to the player, the banker calls the guard to kick the player out and gives the guard 100 dollars.

 

For the guard:

  • When the guard has to kick i-th player who is a cheater out, if guard_ski < skii, the guard has to pay (skii - guard_ski) dollars to the i-th player; if guard_ski >= skii, the guard doesn't have to pay.
  • When the guard has to kick a bankrupt player out, the guard doesn't have to pay.

 

For the player:

  • If the i-th player loses, the i-th player has to pay beti dollars to the banker.
  • If the i-th player loses but beti >= the amount of money the i-th player has now, the i-th player only has to pay all the money they have. In this case, the i-th player becomes bankrupt.
  • If the i-th player is already kicked out of the casino, ignore any of the i-th player's bets and cards.

 

The banker and the guard have 0 dollars at first.

 

You can use the following code to draw cards.

this->cards = 0;
string res = "";
while (res.size() <= 0)
    getline(cin, res);
stringstream ss(res);
while (ss >> res) {
    int temp = 0;
    for (int i = 0; i < (int)res.size(); ++ i)
        temp = temp * 10 + res[i] - '0';
    this->cards += temp;
}

Input

The first line of the input contains two numbers — guard_ski and banker_ski.

The second line of the input contains a number — the number of players.

Each of the next N lines contains a string namei and two numbers mi and skii — the name, money, and the skill the i-th player has.

The next line contains a number K — there will be K rounds of twenty two today.

The following contains blocks, i = 1, ..., N.

There will be a string namei and a number beti in the 2i - 1 line — the i-th player's name and the bets they place.

There will be some numbers c1, ..., ct in the 2i line — the cards the i-th player has.

The last line of each block will be some numbers c1, ..., ct — the cards the banker has.

 

N, K <= 500.

All the other numbers <= 5*104.

Output

You should print N+1 lines in total.

The first line of output should contains two numbers guard_money and banker_money — the money the guard and the banker gets.

Each of next N lines should contains a string namei and moneyi — the name of the i-th player and the money they have after playing.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13529.cpp

Partial Judge Header

13529.h

Tags




Discuss