3249 - I2P(I)2025_Chou_Hu_Hw4_ClassA Scoreboard

Time

2025/10/13 20:30:00 2025/10/20 18:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14766 The Great Tariff Cleanup
14787 Knight’s Tour: NewJeans vs. aespa World Tour

14766 - The Great Tariff Cleanup   

Description

President Trump has once again taken matters into his own hands, this time, to “fix” the global economy by personally deleting every tariff policy ever made. Naturally, the policies are stored in a complicated nested folder system, because what’s more “simple” than thousands of trade files inside /root

Your job is to simulate the behavior of the Unix command rm -r, recursively wiping out every folder and file in post-order traversal. Just make sure to print each deletion path — after all, he’ll probably want to tweet about how “tremendously efficient” his cleanup was.


The folder structure is represented as an n-ary tree, written as a nested list.
Each node is represented as:

[name, [child1, child2, child3, ...]]

That is,

  • t[0] is the name of the current folder or file
  • t[1:] (if any) are its subtrees (children)

You must recursively delete all nodes in post-order traversal, meaning all children are deleted before their parent node. For each deletion, output the full path of the node, starting from the root (prefixed with /).

Input

The input consists of a single line containing a valid list representation of an n-ary tree.
 The list uses the following format:

[name, [child1, child2, ...]]

Constraints:

  • All names consist only of lowercase English letters, digits, periods (.), or underscores (_) — no spaces.
  • The root node’s name is always "root".
  • The input list is guaranteed to be a valid Python list that can be parsed safely using ast.literal_eval().

NOTE:
You can use Python’s ast.literal_eval() to safely convert the string input into a list structure before processing.
For example:

import ast
tree = ast.literal_eval(input().strip())

Then you can recursively traverse the tree to perform the deletions.

Output

Print the deletion order in post-order traversal.

Each line should be in the form:

Deleting <full_path>

where <full_path> is the absolute path to the node starting from /root.

Sample Input  Download

Sample Output  Download

Tags

121515



Discuss




14787 - Knight’s Tour: NewJeans vs. aespa World Tour   

Description

A tense standoff brews between NewJeans and aespa. To decide who reigns as the best 4th-gen group, Minji and Winter are locked in a high-stakes Knight’s Tour duel

Both idols command a knight starting from the top-left corner (0, 0), racing to visit every cell exactly once while following the fixed move order from the problem description.

Help Minji execute the perfect tour and outsmart Winter. If NewJeans wins, they’ll not only claim the 4th-gen crown, but fans might finally witness their long-awaited comeback (╥ᆺ╥;)


You are given a 0-indexed rectangular chessboard of size m × n.
A knight starts at the top-left cell (0, 0) and must move until every cell is visited exactly once.

At each move, you must record the step index into the current cell:

  • The starting cell (0, 0) has value 0.
  • After every legal move, the step index increases by 1.

When choosing where the knight moves next, you must follow a fixed priority order of possible moves. At each step, try the following moves in order, and take the first valid one (i.e., inside the board and not yet visited):

  1. (i + 2, j + 1)
  2. (i + 2, j - 1)
  3. (i - 2, j + 1)
  4. (i - 2, j - 1)
  5. (i + 1, j + 2)
  6. (i + 1, j - 2)
  7. (i - 1, j + 2)
  8. (i - 1, j - 2)

Where:

  • i represents the row index (0 ≤ i < m)
  • j represents the column index (0 ≤ j < n)

Knight's moves reference:

 

Input

Two integers m and n, separated by a space — representing the number of rows and columns of the chessboard.

Constraints:

  • 0 < m, n < 8
  • It is guaranteed that for all given test cases, a valid knight’s tour exists.

Output

Print a 2D list representing the knight’s move order, where each element is the step index when the knight visited that cell.

Example output (from # Sample out 1):

[[0, 3, 6, 9], [11, 8, 1, 4], [2, 5, 10, 7]]

Sample Input  Download

Sample Output  Download

Tags




Discuss