Maze
Statement
The program:
Your program must determine the possible exits of a maze.
The maze can have several exits or none, and may contain loops or parts that cannot be reached from the starting point.
The maze can have several exits or none, and may contain loops or parts that cannot be reached from the starting point.
INPUT:
Line 1: two ints W and H representing the width and height of the maze.
Line 2: two ints X and Y representing your start position in the maze.
H following lines: one row of the maze. A . represents an empty cell and a # represents a wall that cannot be traversed.
Line 2: two ints X and Y representing your start position in the maze.
H following lines: one row of the maze. A . represents an empty cell and a # represents a wall that cannot be traversed.
OUTPUT:
Line 1: an integer N representing the number of exits.
N following lines: two ints EX and EY representing the coordinates of each exit, given ordered by EX, then by EY (i.e. 2 10 comes before 5 1).
N following lines: two ints EX and EY representing the coordinates of each exit, given ordered by EX, then by EY (i.e. 2 10 comes before 5 1).
CONSTRAINTS:
7<=W<=21
7<=H<=21
7<=H<=21
EXAMPLE:
Input
7 7
1 1
#######
#.....#
#####.#
#.#...#
#.#.###
#......
#######
1 1
#######
#.....#
#####.#
#.#...#
#.#.###
#......
#######
Output
1
6 5
6 5
Tags
Difficulty
Test cases
Single exit, 7x7 Test
Input
7 7
1 1
#######
#.....#
#####.#
#.#...#
#.#.###
#......
#######
Output
1
6 5
Validator 1 Validator
Input
11 11
5 5
###########
......#...#
#.###.###.#
#...#.....#
#.#.#######
#.#...#...#
#####.###.#
#...#.....#
#.#######.#
#.........#
###########
Output
1
0 1
Multiple exits, 11x11 Test
Input
11 11
5 5
###########
......#...#
#.###.###.#
#...#.....#
#.#.#######
#.#...#...#
#####.###.#
#...#.....#
#.#######.#
#..........
###########
Output
2
0 1
10 9
Validator 2 Validator
Input
11 11
5 5
#######.###
......#...#
#.###.###.#
#...#.....#
#.#.#######
#.#...#...#
#####.###.#
#...#.....#
#.#######.#
#..........
#.#########
Output
4
0 1
1 10
7 0
10 9
No way out Test
Input
11 11
5 5
###########
#.....#...#
#.###.###.#
#...#.....#
#.#.#######
#.#...#...#
#####.###.#
....#.....#
#.#########
#..........
###########
Output
0
Validator 3 Validator
Input
11 11
5 5
###########
......#...#
#####.###.#
#...#......
#.#.#######
#.#...#...#
#####.###.#
#.....#...#
#.#########
#.........#
###########
Output
0
Loops Test
Input
11 11
5 5
###########
......#...#
#.###.###.#
#...#.....#
#.#.#.##.##
#.#...#...#
#.###.###.#
#...#.....#
#.###.###.#
#.........#
###########
Output
1
0 1
Validator 4 Validator
Input
11 11
5 5
###########
......#...#
#.###.###.#
#...#.....#
#.#.#.##.##
#.#...#...#
#.###.###.#
#...#......
#.###.###.#
#.........#
###########
Output
2
0 1
10 7
All together, 21x21 Test
Input
21 21
9 10
##########.##########
..#...........#.....#
#.#.#########.#.###.#
#...#.........#.#...#
###############.#.###
#.....#.......#.#...#
#.#######.###.#.#.#.#
#...#...#...#...#.#..
###.###.###.###.#.#.#
#.#.#.#...#.#...#.#.#
#.#.#.#.#.#.#.###.#.#
#...#.#.#.#.#...#.#.#
#####.###.#.#####.###
#.#.......#.#...#...#
#.#.#######.#.#.###.#
#.#.#...#...#.#.#...#
#.#.###.#.#####.#####
#.#.................#
#.#######.#########.#
#.........#..........
####.######.#########
Output
4
4 20
11 20
20 7
20 19
All together 2, 21x21 Validator
Input
21 21
9 10
########.############
..#.......#.........#
#.#.#.#####.#######.#
#...#.......#...#...#
###.#########.#.#.###
#.....#.......#.....#
#.###.#.#########.#.#
#.#.....#.#.......#..
#.#.#####.#.#######.#
#...#...#.#...#.....#
#.###.#.#.###.#######
......#.#...#.#.....#
#######.#.#####.###..
#.....#.#.#...#.#...#
#.###.#.#.###.#.#.###
#.#...#.....#...#...#
#.#################.#
#...................#
#.#.###########.#####
#.#...........#......
#####################
Output
4
0 1
0 11
8 0
20 7
Solution language
Solution
Stub generator input