P2960 [USACO09OCT] Invasion of the Milkweed G
Description
Farmer John has always done his best to keep the pastures full of luscious, delicious healthy grass for the cows. He has lost the battle, though, as the evil milkweed has attained a foothold in the northwest part of his farm.
The pasture, as usual, is partitioned into a rectilinear grid of height Y (1
Input Format
\* Line 1: Four space-separated integers: X, Y, Mx, and My
\* Lines 2..Y+1: Line y+1 describes row (Y+2-y) of the field with X characters ('.' for grass and '\*' for a boulder)
Output Format
\* Line 1: A single integer that is the week number when the milkweed takes over the last remaining non-boulder square of the pasture.