QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 512 MB مجموع النقاط: 100

#74. 俄罗斯方块谜题

الإحصائيات

Teto 拥有无限数量的 S 型俄罗斯方块(S-mino)。下图展示了一个 S 型方块:

初始时,所有方块都以此方向放置。Teto 想要在 $N \times N$ 的网格上放置一些方块。网格初始为空。此外,他有一个计数器,初始值设为零。

他可以执行以下操作:

  • 将一个 S 型方块放置在网格上(方块必须完全位于网格内)。方块必须与网格对齐,且任意两个方块不能重叠。
  • 将一个 S 型方块顺时针旋转 90 度,并将计数器加 1。
  • 将一个 S 型方块沿水平轴翻转,并将计数器加 1。
  • 所有旋转或翻转后的方块都必须放置在网格上。

Rotate

Flip

给定 Teto 放置完方块后的网格状态。对于每个 $(i, j)$,如果 $s_{i,j}$ 为 'o',则表示从上往下第 $i$ 行、从左往右第 $j$ 列的单元格被其中一个方块占据。否则,$s_{i,j}$ 为 '.',表示该单元格为空。

计算计数器的奇偶性。保证该奇偶性是可以唯一确定的。

输入格式

$N$ $s_{1,1} \dots s_{1,N}$ $\vdots$ $s_{N,1} \dots s_{N,N}$

  • $1 \le N \le 50$
  • 对于每个 $(i, j)$,$s_{i,j}$ 为 'o' 或 '.'。

输出格式

输出计数器的奇偶性(0 或 1)。

样例

样例输入 1

6
.oooo.
oooooo
oooooo
oooooo
oooooo
.oooo.

样例输出 1

0

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.