P9303 [CCC 2023 J5] CCC Word Hunt

题目描述

In the CCC Word Hunt, words are hidden in a grid of letters. The letters of a hidden word always appear in order on horizontal, vertical, or diagonal line segments in one of two ways.One way is for the letters of a word to appear on one line segment. The other way is for the letters of a word to appear on one line segment up to some letter and then on a second line segment that forms a right angle at this letter. Given a grid of letters and a single word to search for, your job is to determine the number of times that particular word is hidden in the grid.

输入格式

输出格式

说明/提示

**本题采用捆绑测试**。 - Subtask $1$($2$ points):隐藏字符串一定在一条水平线段上。 - Subtask $2$($2$ points):隐藏字符串一定在一个水平或垂直线段上。 - Subtask $3$($2$ points):隐藏字符串一定在一个水平、垂直或对角线线段上。 - Subtask $4$($9$ points):隐藏字符串一定在一个线段或两个互相垂直的线段上。 样例 $1$ 图解: ![](https://cdn.luogu.com.cn/upload/image_hosting/wqo2un8k.png) 样例 $2$ 图解: ![](https://cdn.luogu.com.cn/upload/image_hosting/v082p2qr.png)