3375 - I2P(I)2026_Hu_Midterm Scoreboard

Time

2026/11/03 18:40:00 2026/11/03 21:40:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
15053 RedCapeFlyingCat's Hammer 2
15077 The Spell Book of the Crimson Demon Village
15078 Mice Bombing

15053 - RedCapeFlyingCat's Hammer 2   

Description

RedCapeFlyingCat is standing at coordinate on a number line and wants to reach the goal at coordinate .

There is a wall at coordinate . At first, RedCapeFlyingCat cannot pass through coordinate . There is also a hammer at coordinate : once RedCapeFlyingCat arrives at coordinate , the hammer is picked up, and from then on the wall can be broken and passed through.

Determine whether RedCapeFlyingCat can reach the goal. If so, find the minimum total distance that has to be traveled.

Explanation

In the sample test case, , , and . The wall is farther away than the goal, so it is not in the way: RedCapeFlyingCat goes straight from to . The total distance is .

Two more examples (they are not given as sample test cases):

  • , , : the wall blocks the way to the goal. RedCapeFlyingCat first goes from to to pick up the hammer (distance ), then goes from to , breaking the wall on the way (distance ). The total distance is .
  • , , : the wall blocks the way to the goal, and it also blocks the way to the hammer. The goal cannot be reached, so the answer is -1.

Input

Three lines, each with one integer:

  • Line 1: , the coordinate of the goal
  • Line 2: , the coordinate of the wall
  • Line 3: , the coordinate of the hammer

Constraints

  • , , and are distinct, and none of them is
  • All input values are integers

Subtasks

Testcase Constraints
1-5 and .
6-10 No additional constraint.

Output

One line containing one integer: the minimum total distance RedCapeFlyingCat has to travel to reach the goal.

If the goal cannot be reached, output -1.

Sample Input  Download

Sample Output  Download

Tags




Discuss




15077 - The Spell Book of the Crimson Demon Village   

Description

Megumin finally opened the old ruin, and inside she found a spell book that explains how to measure the power of a spell. According to the book, the letter with the largest ASCII code becomes the core of the spell, with power equal to the square of its ASCII code. The letters to the left of the core add their power to it, while the letters to the right of the core subtract their power from it. Given a spell consisting of lowercase English letters, help Megumin compute its power , defined recursively as follows:

  • denotes the length of , and denotes the ASCII code of character . When , is the ASCII code of the only character in .
  • is the character in with the largest ASCII code. If several characters share the largest ASCII code, is the leftmost one (the one with the smallest index).
  • and are obtained by splitting at :
    • is the substring to the left of .
    • is the substring to the right of .
    • Neither nor contains itself, and either of them may be empty.

For example, if the spell is , the letter with the largest ASCII code is n, which appears at indices 2 and 4 (0-indexed). is the leftmost one, at index 2:

P("banana") = P("ba") + ASCII('n')^2 - P("ana")
P("ba")     = P("") + ASCII('b')^2 - P("a")  = 0 + 9604 - 9409 = 195
P("ana")    = P("a") + ASCII('n')^2 - P("a") = 9409 + 12100 - 9409 = 12100
P("banana") = 195 + 12100 - 12100 = 195

Input

A single line containing the string .

Constraints

  • consists only of lowercase English letters (a–z).

Subtasks

  • Subtask 1 (Testcase 1-5): All characters in are distinct.
  • Subtask 2 (Testcase 6-10): No additional constraints.

Output

Output a single integer, the power . Note that the answer may be negative.

Sample Input  Download

Sample Output  Download

Tags




Discuss




15078 - Mice Bombing   

Description

Elfnt's home has been invaded by mice. So he decides to BOMB THEM ALL!

You are given an grid. Each cell shows the number of mice in it. A cell with is an obstacle.

Bombs have a strength , which starts at . A bomb hits the cell it lands on. Its shockwave then spreads up to cells in each of its directions. In each direction, the shockwave stops at an obstacle or at the edge of the grid, and obstacles are never hit.

For every cell that is hit, including the bomb's own cell, the number of mice decreases by . The number of mice cannot go below .

Process commands in the given order. There are 3 types of commands:

  • + i j k: Drop a cross bomb at . Its shockwave spreads up, down, left and right, and each cell it hits loses mice.
  • X i j k: Drop an X bomb at . Its shockwave spreads in the four diagonal directions, and each cell it hits loses mice.
  • Set s: Set .

Print the final grid.

Rule visualized:

Template

# Input (Read the commands by yourself)
n, m = map(int, input().split())
mp = []
for _ in range(n):
    mp.append(list(map(int, input().split())))
q = int(input())

# Implement here


# Output
for row in mp:
    print(*row)

Input

The first line contains and .

Each of the next lines contains integers describing one row of the grid.

The next line contains .

Each of the next lines contains one command.

Rows and columns are 0-indexed. means row , column , and is the top-left cell.

Constraints

  • Each cell is or an integer from to .
  • ,
  • No bomb is dropped on an obstacle.

Subtasks

  • Test cases 1–2: No obstacles, no Set commands, and no X bombs.
  • Test cases 3–4: No obstacles and no X bombs.
  • Test cases 5–6: No obstacles.
  • Test cases 7–10: No additional constraints.

Output

Print lines with integers each, and print obstacles as .

Separate the integers with single spaces. Do not print trailing spaces. End every line with a newline, including the last.

The template above already reads the input and prints the output in this format.

Sample Input 1  Download

Sample Output 1  Download

Sample Input 2  Download

Sample Output 2  Download

Sample Input 3  Download

Sample Output 3  Download

Sample Input  Download

Sample Output  Download

Tags




Discuss