wyuan; castle; Cheated - Copy from http://www.nocow.cn/index.php/Code:USACO/castle/C%2B%2B. To do -- Use both flood fill and Union Set.