RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
R03604

J5. Harvest Waterloo

Unrated 레이팅 미적용
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

There is a wildly popular new harvest simulation game called
Harvest Waterloo. The game is played on a rectangular pumpkin
patch which contains bales of hay and pumpkins of different sizes. To
begin the game, a farmer is placed at the location of a pumpkin.

The farmer harvests all pumpkins they can reach by moving left,
right, up, and down throughout the patch. The farmer cannot move
diagonally. The farmer can also not move through a bale of hay nor move
outside of the patch.

Your job is to determine the total value of all the pumpkins
harvested by the farmer. A small pumpkin is worth $\$1\(, a\ medium\ pumpkin\ is\ worth \)\$5\(, and\ a\ large\ pumpkin\ is\ worth \)\$10$ dollars.

제약

\(R > 0\)
\(C > 0\)
\(0 \leq A < R\)
\(0 \leq B < C\)

입력 형식

The first line of input is an integer \(R > 0\) which is the number of rows within the patch.

The second line of input is an integer \(C > 0\) which is the number of columns within the patch.

The next \(R\) lines describe the
patch. Each line will contain \(C\)
characters and each character will either represent a pumpkin size or a
bale of hay: S for a small pumpkin, M for a
medium pumpkin, L for a large pumpkin, or *
for a bale of hay.

The next line of input is an integer \(A\) where \(0 \leq A < R\), and the last line of input is an integer \(B\) where \(0 \leq B < C\). Row \(A\) and
column \(B\) is the starting location
of the farmer and the top-left corner of the patch is row \(0\) and column \(0\).

출력 형식

Output the integer, \(V\), which is
the total value in dollars of all the pumpkins harvested by the
farmer.

서브태스크
서브태스크점수설명

1

6점

The patch is small and there are no bales of hay. — \(R \times C \leq 100\)

2

26점

The patch is small and the bales of hay divide the entire patch into rectangular areas. — \(R \times C \leq 100\)

3

34점

The patch is small and the bales of hay can be anywhere. — \(R \times C \leq 100\)

4

34점

The patch is large and the bales of hay can be anywhere. — \(R \times C \leq 100\,000\)

예제 1
입력
6
6
**LMLS
S*LMMS
S*SMSM
******
LLM*MS
SSL*SS
5
1
출력
37
설명

Starting at row 5 and column 1, the farmer can reach the 6 pumpkins
in the highlighted area. They harvest 2 small pumpkins, 1 medium
pumpkin, and 3 large pumpkins. The total value in dollars of this
harvest is \(2 \times 1 + 1 \times 5 + 3 \times 10 = 37\).

예제 2
입력
6
6
**LMLS
S*LMMS
S*SMSM
***SLL
LLM*MS
SSL*SS
2
4
출력
88
설명

Starting at row \(2\) and column
\(4\), the farmer can reach the \(19\) pumpkins in the highlighted area. They
harvest \(8\) small pumpkins, \(6\) medium pumpkin, and \(5\) large pumpkins. The total value in
dollars of this harvest is \(8 \times 1 + 6 \times 5 + 5 \times 10 = 88\).

문제 정보

생성자가 기록되지 않았습니다.

출처 CCC 2024 Junior

평가 및 의견

J5. Harvest Waterloo

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

J5. Harvest Waterloo

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8