A. 三码窗口统计
三码窗口统计
春招模拟赛第十场|协程|2023.04.15研发岗笔试
- Status
- Done
- Rule
- IOI
- Problem
- 4
- Start at
- 2023-4-24 19:00
- End at
- 2023-4-24 21:00
- Duration
- 2 hour(s)
- Host
- Partic.
- 41
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
枚举每个 2×2 窗口左上角,检查四个字符组成的集合是否覆盖 y、o、u。
时间复杂度 O(nm),空间复杂度 O(nm)。
工位抽检得到一张 n 行 m 列的小写字母编码表。质检规则关注每一个 2×2 窗口:若该窗口四个格子的字符集合同时包含 y、o、u 三种字母,则记为一次命中。需要统计命中窗口的个数,用于评估编码表是否出现异常聚集。
请输出命中窗口的数量。
约束:1≤n,m≤1000。
第一行两个正整数 n 和 m。 接下来 n 行,每行一个长度为 m 的小写字母串。
输出一个整数,表示符合条件的 2×2 子矩阵个数。
输入
2 2
yo
ux
输出
1
说明
按题意模拟计算得到。
输入
3 3
abc
def
ghi
输出
0
说明
按题意模拟计算得到。
输入
2 3
you
ouy
输出
2
说明
按题意模拟计算得到。
Scan the QR code below with WeChat to sign in
First-time scan will create your account automatically
请使用微信扫描下方二维码完成注册