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

26573번 - Trail 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB86675.000%

문제

Ann works for a shipping company in the wild frontier. Her job is simple; she must deliver a package to the West before a certain deadline. You are to determine when Ann will reach her destination and whether or not Ann is late.

You will be given a top-down map of the area Ann must traverse and the number of days until the deadline that Ann must deliver the package by. It will take Ann 3 days to cross a normal area of land, 5 days to cross a wooded area, and 8 days to cross a body of water. Ann cannot cross over rocks because it will break her wagon. Her goal is to get to the West, which is simply the far left column on the map. She can travel in any of the four directions: north, east, south, and west (no diagonals). On some maps it may be impossible for Ann to reach the West.

Note: The far left column will contain only . (periods) and is not included in the overall time.

입력

The first line of input will contain a single integer n that indicates the number of data sets to follow. Each data set will consist of:

  • A line containing two integers: rows and cols, indicating the number of rows and columns, respectively. The value of rows and cols will both be between 1 and 50, inclusive.
  • The next rows lines of cols characters will be the map of the area. Each character will be one of the following:
    • . (period) – a normal area of land
    • W – an area of water
    • R – a rock
    • F – a wooded area
    • S – Ann’s starting location, there will only be one of these
  • The next line will contain a single integer, between 1 and 300 inclusive, which represents the number of days until the deadline.

출력

You are to output the result of Ann’s trip. If Ann is able to get to the West by the deadline print “The Package arrived with d day(s) to spare.” where d is the number of days still left until the original deadline. If Ann cannot deliver the package in time, simply print “The Package was not delivered in time.”

제한

예제 입력 1

2
7 7
..W....
..W....
..W....
..W..FF
..W.R..
..W..R.
.....RS
35
5 10
....RF....
....RF....
...R.FF..S
..R..FF...
...R.FF...
50

예제 출력 1

The Package arrived with 4 day(s) to spare.
The Package was not delivered in time.

힌트

출처

School > PLU High School Programming Contest > PLU 2019 > Advanced 12번

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

출처

대학교 대회

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

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