第十六篇英语翻译

重点单词:

parse v/n.分析,研究;

palindrome n.回文;

concatenate v.链接,连接,adj.连接的,连续的;

peculiar adj.奇怪的,特别的,不寻常的;

subsequence n.随后,接着;

a subsequence of n.一系列;

出处:https://acs.jxnu.edu.cn/contest/23/board/challenge/F

Peculiar Movie Preferences

独特的电影偏好

描述:

Mihai plans to watch a movie. He only likes palindromic movies, so he wants to skip some (possibly zero) scenes to make the remaining parts of the movie palindromic.

米海计划看一部电影。他只喜欢回文电影,所以他想跳过一些(可能零)场景,使电影的其余部分回文。

You are given a list ss of nn non-empty strings of length at most 33, representing the scenes of Mihai's movie.

你会得到一个由n个长度不超过3的非空字符串组成的列表,代表米海电影的场景。

A subsequence of s is called awesome if it is non-empty and the concatenation of the strings in the subsequence, in order, is a palindrome.

某一系列情景s会被称作绝妙如果他是非空的,且在这一系列中连续的字符串是按照一定规律回文;

Can you help Mihai check if there is at least one awesome subsequence of ss?

A palindrome is a string that reads the same backward as forward, for example strings "z", "aaa", "aba", "abccba" are palindromes, but strings "codeforces", "reality", "ab" are not.

A sequence aa is a non-empty subsequence of a non-empty sequence bb if aa can be obtained from bb by deletion of several (possibly zero, but not all) elements.

你能帮Mihai看看是否有至少一个很棒的s子序列吗?

 

回文是一个前后读相同的字符串,例如字符串“z”、“aaa”、“aba”、“abccba”是回文,而字符串“codeforces”、“reality”、“ab”则不是。

 

如果可以通过删除几个(可能是零,但不是全部)元素从b中获得A,则序列A是非空序列b的非空子序列。

 

输入:

The first line of the input contains a single integer tt (1t1001≤t≤100) — the number of test cases. The description of test cases follows.

The first line of each test case contains a single integer nn (1n1051≤n≤105) — the number of scenes in the movie.

Then follows nn lines, the ii-th of which containing a single non-empty string sisi of length at most 33, consisting of lowercase Latin letters.

It is guaranteed that the sum of nn over all test cases does not exceed 105105.

输入的第一行包含一个整数t(1≤T≤100)-测试用例的数量。测试用例的描述如下。

 

每个测试用例的第一行包含一个整数n(1)≤N≤105)-电影中的场景数量。

 

然后是n行,第i行包含一个长度不超过3的非空字符串si,由小写拉丁字母组成。

 

保证所有测试用例中n的总和不超过105。

 

输出:

For each test case, print "YES" if there is an awesome subsequence of ss, or "NO" otherwise (case insensitive).

样例输入:

6
5
zx
ab
cc
zx
ba
2
ab
bad
4
co
def
orc
es
3
a
b
c
3
ab
cd
cba
2
ab
ab

样例输出:

YES
NO
NO
YES
YES
NO

注释:

In the first test case, an awesome subsequence of ss is [ab,cc,ba]

posted @ 2022-02-08 23:33  次林梦叶  阅读(172)  评论(0)    收藏  举报