| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12246 | Tic-Tac-Toe Tree Path |
|
Description
Given:
- A series of nodes representing the possible steps in Tic tac toe
- A tic-tac-toe grid
Task:
- Convert the input data into a tree
- Find the root to node path leading to the grid (starting from root)
Input
- An integer N, the number of nodes in tree , newline at the end
- N lines indicating the node contents. Each line looks like below:
Node Id, Parent Id, Position x, position Y, Mark (either 'O' or 'X'); separated by whitespaces, newline at the end - 3 lines, with the Tic-tac-toe grid:
- Each line has 3 marks (‘X’,’O’,’_’), separated by whitespaces, newline at the end
Notes:
- Node Id is an integer ranging from 0 to 100.
- Parent Id is an integer ranging from-1 to 99, where -1 is the root.
- Position x and position y are integers ranging from 0 to 2, indicating the tic-tac-toe grid position.
- The tic-tac-toe gris positions are illustrated below:
Output
IDs of the nodes in the path leading to the grid, separated by whitespaces, followed by a new line. (Starting from root)