QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#3742. 卖萌表情

الإحصائيات

已知以下 4 种都是卖萌表情(空白的部分可以是任意字符。竖线是便于展示的分隔符,没有实际意义):

^ ^ |  ^  | <  |  >
 v  | v v |  > | <
    |     | <  |  >

给出 $n$ 行 $m$ 列的字符矩阵,Bobo 希望找出互不重叠的卖萌表情数量的最大值。互不重叠的意思是每个字符只属于至多一个卖萌表情。

输入格式

输入文件包含多组数据,请处理到文件结束。

每组数据的第一行包含 $2$ 个整数 $n$ 和 $m$.

接下来 $n$ 行的第 $i$ 行包含长度为 $m$ 的字符串,表示字符矩阵的第 $i$ 行。

输出格式

对于每组数据输出 $1$ 个整数表示互不重叠的卖萌表情数量的最大值。

样例输入

2 4
^^^^
>vv<
2 4
vvvv
>^^<
4 2
v>
<>
<>
^>
3 4
^>^>
<v>v
>>>>

样例输出

2
0
2
2

样例解释

第一组样例中有 $2$ 个第一种卖萌表情。

第四组样例中有 $3$ 个卖萌表情,但是互不重叠的卖萌表情最多只有 $2$ 个。

数据范围

  • $1 \leq n, m \leq 1000$
  • 矩阵只包含 ^, v, <, > $4$ 种字符。
  • $n \times m$ 的和不超过 $2 \times 10^6$.
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.