| RACSODFACFGOperations: Reg, CFPDAReductions: K, WP, CFG, NP, SATANTLR: lex, synExams | log in, register, become guest |
· # · # #
· · · · ·
· # · # ·
· · · · ·
# # · # s
in which walls have been indicated with a #, the following path
1) 2) 3)
· # · # # · # · # # · # · # #
^
· · · · · · · · · · · · · · ·
^
· # · # · · # · # · · # o # ·
^ ^ v
· · · < · < · · · o o o · < · < o o o
v ^ ^
# # · # s # # o # o # # o # o
4) 5) 6)
o # · # # o # o # # o # o # #
v ^ v
o > · > · · · o o o > · > · o o o o o
v
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
visits all walkable cells, and has cells (note that the initial in the
path is also counted).
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.
|
|