I made a mistake in my interpretation of the original problem statement. In the original problem it was allowed, that two mines are adjacent, like in this example:
Code: Select all
6 5
#####
# #
# **#
# **#
# #
#####
Code: Select all
#####
# #
# --#
# --#
# #
#####
For example this is one of my test cases and my solution for it:
Code: Select all
10 10
##########
#........#
#..*.*...#
#...*....#
#..*..*..#
#...*....#
#..*.*...#
#........#
#........#
##########
20
##########
#..X.X...#
#..*.*...#
#...*X...#
#XX*..*XX#
#...*X...#
#..*.*...#
#..X.X...#
#..X.X...#
##########