Shooting Bricks

TimeLimit:2000MS  MemoryLimit:262144KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Kris has a deep affection for a computer game named Shooting Bricks, described as follows:

The game is initialized with $n\times m$ bricks, placed in $n$ rows and $m$ columns. Players will be able to choose a column and shoot the outermost brick with a pistol. Shooting different bricks results in different bonus points, and shot bricks will disintegrate into ashes. Moreover, by shooting some special bricks, players can get a single bullet as a reward. It is the players' goal to achieve the highest overall bonus score.

Now Kris only has $k$ bullets, and he wonders how many bonus points he can obtain at most.
Input
This problem contains multiple test cases.

The first line contains an integer $T(1\le T\le 20)$, the number of test cases.

Each test case starts with a line of three integers $n,m,k(1\le n,m,k\le 200)$.

Then $n$ lines follow. The $i$th line contains $m$ pairs of $f_{ij},c_{ij}(1\le f_{ij}\le 10^4,c_{ij}\in \{\texttt{Y},\texttt{N}\})$, meaning if the brick located at the $i$th line and $j$th column is shot, player will get $f_{ij}$ points and will( Y) or won't( N) get a reward bullet after that. Initally, the bricks at the $n$th line is exposed outside, so you need to shoot them as a start.
Output
For each test case, print a line of a single integer, denoting the highest bonus score.
SampleInput
1
2 2 1
1 Y 1 N
1 Y 1 Y
SampleOutput
4

 Hint In the example, all bricks can be shot, shooting sequence (2, 1), (1, 1), (2, 2), (1, 2) is one of the solutions. Here is a link that may help you understand this problem. But please notice that it has nothing to do with this problem. https://ccpc-online-2021.github.io/brick Pay attention to the time you waste!
Submit
题目统计信息详细
总AC数2
通过人数2
尝试人数2
总提交量3
AC率66.67%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: