QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 512 MB Puntuación total: 100

#4510. 巨幅画作

Estadísticas

Samuel W. E. R. Craft 是一位声名鹊起的艺术家。不幸的是,他卖出的画作赚到的钱不足以支付他的日常开销以及购买新的绘画用品。昨天,当他的空白画布用完时,他产生了一个绝妙的想法:“为什么我不创作一幅巨大的新画,把我所有卖不出去的画拼接在一起呢?”经过一整天的工作,他的杰作完成了。

就在这时,他接到了一个意想不到的电话:一位客户看到他其中一幅画的照片,现在愿意购买它!他忘记告诉画廊将他的旧作品从目录中删除了!他通常会欢迎这样的电话,但面对眼前这幅巨大的画作,他该如何找到他的旧作品呢?

题目描述

给定他原始画作的黑白表示以及他杰作的黑白表示,你能帮助 S.W.E.R.C. 确定他的画作可能出现在多少个位置吗?

输入格式

第一行包含 4 个空格分隔的整数:$h_p, w_p, h_m, w_m$,分别代表他需要寻找的画作的高度和宽度,以及他杰作的高度和宽度。

接下来的 $h_p$ 行包含 $w_p$ 个小写字符,表示他的画作。此后,接下来的 $h_m$ 行包含 $w_m$ 个小写字符,表示他的杰作。每个字符均为 'x' 或 'o'。

数据范围

$1 \le h_p, w_p \le 2\,000$ $1 \le h_m, w_m \le 2\,000$ $h_p \le h_m$ $w_p \le w_m$

输出格式

一个整数,表示他的画作可能存在的位置数量。

样例

输入 1

4 4 10 10
oxxo
xoox
xoox
oxxo
xxxxxxoxxo
oxxoooxoox
xooxxxxoox
xooxxxoxxo
oxxoxxxxxx
ooooxxxxxx
xxxoxxoxxo
oooxooxoox
oooxooxoox
xxxoxxoxxo

输出 1

4

说明 1

这幅画可能出现在四个位置,如下图所示。其中两个位置有重叠。

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.