QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100 Difficulty: [show] Hackable ✓

#4241. Angle Beats 2.0

Statistics

你有一个 $n \times m$ 的矩形棋盘。每个方格中包含一个字符,要么是 “*”,要么是 “.”。

一个三格骨牌(tromino)由棋盘上的一个方格(称为中心)和另外两个与中心共享边的方格组成。如果这两个方格有一个公共顶点,则该三格骨牌是 L 型的。

你可以在棋盘上绘制一些不相交的 L 型三格骨牌。L 型三格骨牌的中心必须包含 “”,且每一个 “” 都必须是某个三格骨牌的中心。

所有三格骨牌的非中心方格必须包含 “.”。

你的目标是求出在满足这些约束条件下,绘制 L 型三格骨牌的方法数。由于答案可能非常大,你只需要输出其对 $998\,244\,353$ 取模的结果。

输入格式

第一行包含一个整数 $t$ ($1 \le t \le 250\,000$):测试用例的数量。

每个测试用例的第一行包含两个整数 $n$ 和 $m$:棋盘的行数和列数 ($2 \le n, m \le 100$)。

接下来的 $n$ 行,每行包含 $m$ 个字符,每个字符为 “*” 或 “.”。这些行共同描述了棋盘。

保证所有测试用例中 $n \cdot m$ 的总和不超过 $1\,000\,000$。

输出格式

对于每个测试用例,输出一个整数:在给定约束下绘制 L 型三格骨牌的方法数。

样例

样例输入 1

3
3 3
...
.*.
...
3 3
*..
...
..*
3 3
...
..*
.*.

样例输出 1

4
1
0

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#578Editorial Open集训队作业 解题报告 by 靳棋皓Qingyu2026-01-02 22:31:05 Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.