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

27392번 - Room Evacuation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
7 초 (추가 시간 없음) 1024 MB2210844.444%

문제

You are now the fire marshal. It is not a fun job to have. You have a layout of a room in the building as a 2D grid. There are known locations that people will occupy, there are known locations that people cannot walk into or out of, and there are known locations that are exits. You know that two or more people cannot occupy the same cell of the 2D grid at the same time. You know how quickly everyone needs to evacuate the room in seconds. Asssume that the occupants can only move in one of the four cardinal directions (i.e., North, South, East, or West), and can make one move per second. You can assume that although only one person can stand in the exit at a time, a person in the exit is safe, and of course anyone past the exit is safe.

Given the layout of the room and the desired time to evacuate, determine how many people can get out safely.

입력

The first line of input contains three integers, $n,ドル $m$ (1ドル \le n,m \le 20$) and $t$ (1ドル \le t \le 200$), where $n$ and $m$ are the height and width of the floor plan, and $t$ is the time allowed to evacuate.

Each of the next $n$ lines contains a string of length exactly $m,ドル consisting only of the characters "P", "E", "#", and/or ".", where:

  • "P" is a person
  • "E" is an exit
  • "#" is a blocked area that people cannot enter or pass through
  • "." is an open area that people can enter and pass through

출력

Output a single integer, which is the number of occupants of the room can be safely evacuated in the allotted time.

제한

예제 입력 1

4 5 3
.....
..P#.
..PPE
..P.E

예제 출력 1

4

예제 입력 2

3 3 5
...
P#P
P#E

예제 출력 2

2

힌트

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2022 J번

  • 문제를 만든 사람: Travis Meade
(追記) (追記ここまで)

출처

대학교 대회

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

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