Logo
(追記) (追記ここまで)

6031번 - Feeding Time 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB30321718872.868%

문제

It's Bessie's feeding time, and Farmer John is trying to decide where to put her. FJ has a farm that comprises W x H (1 <= W <= 750; 1 <= H <= 750) squares and is partitioned into one or more separate pastures by rocks both large and small. Every pasture contains some grass and some rocks.

Bessie is a hungry little cow and just loves to eat, eat, eat her grass. She can move from any square to any other square that is horizontally, vertically, or diagonally adjacent. Bessie can't cross the rocks because they hurt her feet, and, of course, she can't leave the farm. Bessie wants to know the maximum number of squares of grass that she can eat.

FJ has a map of his farm, where a '.' represents a square of grass, and a '*' represents a rock. Consider this 10x8 map and a detailed breakdown of the extent of each of its three pastures:

 ...*....** | 111*....** ...*2222** ...*....**
 ..**....** | 11**....** ..**2222** ..**....**
 ...*....** | 111*....** ...*2222** ...*....**
 ...**.*.** | 111**.*.** ...**2*2** ...**.*.**
 ***.**.*** | ***1**.*** ***.**2*** ***.**.***
 ...**.*.** | 111**.*.** ...**2*2** ...**.*.**
 ...*.***** | 111*.***** ...*2***** ...*.*****
 ...***..** | 111***..** ...***..** ...***33**

Pasture 1 has 21 squares; pasture 2 has 18 squares; pasture 3 has 2 squares. Thus Bessie should choose pasture 1 with 21 squares to maximize the grass she can eat.

입력

  • Line 1: Two space-separated integers: W and H
  • Lines 2..H+1: Line i+1 describes field row i with W characters (and no spaces), each either '.' or '*'

출력

  • Line 1: A single integer that represents the maximum number of squares of grass that Bessie can eat.

제한

예제 입력 1

10 8
...*....**
..**....**
...*....**
...**.*.**
***.**.***
...**.*.**
...*.*****
...***..**

예제 출력 1

21

힌트

출처

Olympiad > USA Computing Olympiad > 2009-2010 Season > USACO February 2010 Contest > Bronze 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /