#63754. [ USACO 2022 Open Silver]Subset Equality
[ USACO 2022 Open Silver]Subset Equality
暂无测试数据。
英文题面
The cows are trying out a new method of exchanging coded messages with each-other where they mix irrelevant letters in among relevant letters to make the messages hard to decode.
The cows transmit two strings $s$ and $t$ each of length at most $10^5$ consisting only of the lowercase English letters 'a' through 'r'. To try and make sense of this coded message, you will be given $Q$ queries ($1 \leq Q \leq 10^5$). Each query provides a subset of the lowercase English letters from 'a' to 'r.' You need to determine for each query whether $s$ and $t$, when restricted only to the letters in the query, are equal.
译文
奶牛们正在尝试一种相互交换编码信息的新方法,她们在相关的字母中混入不相关的字母,使信息难以解码。
奶牛们传输两个字符串 $s$ 和 $t$,每个字符串的长度不超过 $10^5$,仅由小写字母 'a' 到 'r' 组成。为了尝试理解这条编码消息,你将被给定 $Q$ 个询问($1 \leq Q \leq 10^5$)。每个询问给定小写字母 'a' 到 'r' 的一个子集。你需要对每个询问判断 $s$ 和 $t$ 在仅包含询问中给定的字母时是否相等。
输入格式
First line contains $s$.
Second line contains $t$.
Third line contains $Q$.
Next $Q$ lines each contain a query string. Within a query string, no letters are repeated. Furthermore, all query strings are in sorted order, and no query string appears more than once.
输入的第一行包含 $s$。
第二行包含 $t$。
第三行包含 $Q$。
以下 $Q$ 行每行包含一个询问字符串。在一个询问字符串中,所有字母均不相同。此外,所有询问字符串均已排序,且没有一个询问字符串出现超过一次。
输出格式
For each query, print 'Y' if $s$ and $t$, when restricted only to the letters in the query, are equal, or 'N' otherwise.
对每个询问,如果 $s$ 和 $t$ 在仅包含询问中给定的字母时相等则输出 'Y',否则输出 'N'。
数据范围
Test case 2 satisfies $|s|, |t|, Q \le 1000$.Test cases 3-11 satisfy no additional constraints.
测试点 2 满足 $|s|, |t|, Q \le 1000$。测试点 3-11 没有额外限制。
aabcd
caabd
4
a
ac
abd
abcd
YNYN