| RACSORDFACFGOperations: Reg, CFPDAReductions: K, WP, CFG, NP, SATANTLR: lex, synExams | log in, register, guest |
· # a # #
· · · · ·
· # · # ·
· · · · ·
# # A # s
in which walkable cells have been indicated with . or a letter
and walls with #, and there is a teleport
from (indicated with A) to (indicated with a),
the following path
· # a # #
· · · · ·
· # · # ·
· · ← · ← · ← ·
↑
# # A # s
· # a # #
· · · · ·
o # o # o
o o → o o o
↓
# # o # o
· # a # #
↓
· · ← · · ·
o # o # o
o o o o o
# # o # o
o # o # #
o o → o → o ·
o # o # o
o o o o o
# # o # o
o # o # #
o o o o o
o # o # o
o o o o o
# # o # o
grid: array of array of int
k: int
s: struct {
r: int
c: int
}
teleports: array of struct {
source: struct {
r: int
c: int
}
target: struct {
r: int
c: int
}
}
The input has the matrix grid, the maximum number of cells
in the path (counting ), the initial cell , and the teleport pairs.
The grid contains
the locations of the walls: grid[i][j] has a to denote that
cell is walkable, and a to denote that the cell has
a wall. The starting cell is a struct with two fields:
r indicates the row,
and c indicates the column.
For instance, in the previous example we would have
s.rs.c. It is guaranteed that every walkable
cell is reachable from the cell without using teleports.
The array teleports contains one entry per teleport. A teleport is
a struct with fields source and target, which in turn
are structs encoding cell coordinates with the usual r and c
fields. For instance, in the previous example we would have a teleport
t from cell t.source.rt.source.c
to cell t.target.rt.target.c.
There cannot be two identical teleports, i.e., with the same source and target.
path: array of struct {
r: int
c: int
}
The output consists of an array of variable length, containing the sequence
of cells that form the path. Each element in the path is a struct with
a pair of numbers r and c, with the same meaning as in s.
The ’th element of the array must be s.
|
|