资格赛A-官方解释

时间:2022-11-30 20:23:16

First we store all the words in a 2 dimensional array.

首先我们在一个二维数组里面储存所有的词。


After that, we read each pattern, parse it, and count how many words match.

然后,我们读每一个样式,解析它,然后统计有多少单词匹配。

One possible way of storing a pattern is a 2 dimensional array P[15][26]. P[i][j] is True only if the i-th token contains the j-th letter of the alphabet, otherwise False. In other words, P[i] is a bitmap of the letters contained by the i-th token.

一个可行的方法,存储一个样式在一个二维数组P[15][26]。P[i][j]是真的,仅当i-th包含字母表中的j-th字符,否则为假。

换句话说,P[i]是一个象征i-th的,包含了字符的位图。

Parsing can be done like this:

解析可以像这样子完成:
- read one character c

读一个字符c
- if c is '(', read characters until we hit ')'. The characters read are the token.
else the token is the character c

如果c是(,读字符直到读到)。读取的字符是token的。
- populate P[i] for the characters in the token

用token中的字符填充P[i]。

To count how many words match, we make sure that each letter i from the word is contained in the bitmap P[i].
为了计算多少词匹配,我们确认每一个来自单词的i,都包含在位图P[i]中。


Total complexity is O(N * L * D).

----------------------------------------------------

好吧,我承认,我是没看懂……。

有看懂的说下~~,非常感谢。