| Swamp | Solution | Tests | 
A swamp has a rectangular shape, with nl rows and nc columns. It is made of cells with the side of one unit length. A part of these cells represent land, other cells water. The land is coded with 0, and the water with 1. We want to obtain a path from the North shore to the South shore, without passing through water. A water cell can be transformed into land by parachuting on it a pontoon having the size of the cell. Because parachuting is dangerous, we want a minimum number of parachutes. We can move only one cell on the same row, the same column or the same diagonal.
Task
Write a program that determines the minimum number of parachuted pontoons.
Input format
The input file LAC.IN has the following structure:
Output format
The output file LAC.OUT will have the following structure:
Restrictions
Observation:
The numbering of the rows and columns starts with 1.
Example:
| LAC.IN | 
| 
       8 9 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 
  | 
  
| LAC.OUT | 
| 
       2  | 
  
Time limit: 1 second