See the assignment turn-in page (last modified on 3 November 2003) for instructions on turning in your assignment.
Each winter community members submit requests for individual plots. The community-garden committee assembles the individual requests in to a layout which assigns plots to community members.
To be useful, a layout must be feasible. A layout is feasible if every individual plot can be irrigated according to the following rules:
isspace()
is true. The first number
may be preceded by, and the last number may be followed by, a sequence of
space characters.
The first pair input gives m and n, the size of the community garden. The remaining pairs x and y give individual-plot locations, 0 < x < m and 0 < y < n.
Any input not conforming to this description should be considered invalid input.
Here's an example of valid input:
5 5 1 2 2 1 2 2 2 3 3 2
where x and y are the coordinates of the individual plot and di is one of n
, e
, s
, or w
. At least one non-newline space
character should separate adjacent output-line elements; a sequence of
non-newline space characters may appear before the first or after the last
output-line element.
n
stands for "north" and represents one step in the positive y
direction; s
stands for "south" and represents one step in the
negative y direction; e
stands for "east" and represents one
step in the positive x direction; w
stands for "west" and
represents one step in the negative x direction.
If the input is not a feasible layout, the word infeasible
should be
written to std-out.
If an error is discovered in input, an informative error message should be written to std-err and the program should end with no further processing.
This page last modified on 21 October 2003.