IARCS home > OLYMPIAD > Archives
Input format next up previous
Next: Output format Up: Chambers in a castle Previous: Chambers in a castle

Input format

The first line of input will have two integers M and N, with $0 < \texttt{M} \leq 500$ and $0 < \texttt{N} \leq
500$. M represents the number of rows and N the number of columns in the floor plan.

This will be followed by M lines of input. Each of these M lines will be a sequence of 0's and 1's of length N, separated by spaces. A 0 represents an open tile (a white square), while a 1 represents a tile with a wall (a black square). The outer boundary of the castle will always consist of an unbroken wall.

The input corresponding to the floor plan in Figure 1 is given in Figure 2.

15 19
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 
1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1
1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1
1 0 0 0 1 0 0 0 0 1 0 1 1 1 1 1 1 1 1 
1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 
1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 0 1 
1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1
1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1
1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 1 
1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 
1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 
1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 
1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Figure 2



Madhavan Mukund 2003-05-22



Copyright (c) IARCS 2003-2018;   Last Updated: 23 May, 2003