reposting since it didn't appear yesterday, apologies
A small variation of Vishal's algorithm to eliminate the need of the
bitmap. I use a hash table of integers index by the keyword,
initialized to all 0. I also make use of the property that in the
shortest summary the first and the last
For each test case
Do
call function Read_it() /* read the next move */
call Count_it() /* count the # of squares walked
through */
while (move length is 0)
print area moved through for that case
next
That would be my starting pseudo-code.
Find the enclosing rectangle for the area. Calculate minX, maxX, minY, maxY.
Now find whether the enclosing area lies to left and right side of the
path**. Note that the path is not self-intersecting.
currX = startX;
area = 0
if ( left ) // enclosing area to left of path
{
for each move
{