| RACSORDFACFGOperations: Reg, CFPDAReductions: K, WP, CFG, NP, SATANTLR: lex, synExams | log in, register, guest |
· # · # #
· · · · ·
· # · # ·
· · · · ·
# # · # s
in which walkable cells have been indicated with . or s
and walls with #, the following path
· # · # #
· · · · ·
· # · # ·
· · · ← · ← ·
↓ ↑
# # · # s
· # · # #
· · · · ·
· # · # ·
↑
· · 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
o # o # o
o o o o o
# # o # o
grid: array of array of int
k: int
s: struct {
r: int
c: int
}
The input has the matrix grid, the maximum number of cells
in the path (counting ), and the initial cell . 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 .
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.
|
|