CF1862A.Gift Carpet
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Recently, Tema and Vika celebrated Family Day. Their friend Arina gave them a carpet, which can be represented as an n⋅m table of lowercase Latin letters.
Vika hasn't seen the gift yet, but Tema knows what kind of carpets she likes. Vika will like the carpet if she can read her name on. She reads column by column from left to right and chooses one or zero letters from current column.
Formally, the girl will like the carpet if it is possible to select four distinct columns in order from left to right such that the first column contains "v", the second one contains "i", the third one contains "k", and the fourth one contains "a".
Help Tema understand in advance whether Vika will like Arina's gift.
最近,特玛和维卡庆祝了家庭日。他们的朋友阿里娜送给了他们一块地毯,该地毯可以表示为一个 n⋅m 的小写拉丁字母表格。
维卡尚未看到这份礼物,但特玛知道她喜欢什么样的地毯。如果维卡能从地毯上读出她的名字,她就会喜欢这块地毯。她按列从左到右阅读,并在当前列中选择一个或零个字母。
形式化地说:如果存在按从左到右顺序排列的四个互不相同的列,使得第一列中包含字母 "v",第二列中包含字母 "i",第三列中包含字母 "k",第四列中包含字母 "a",那么维卡就会喜欢这块地毯。
请帮助特玛提前判断维卡是否会喜欢阿里娜的这份礼物。
输入格式
Each test consists of multiple test cases. The first line of input contains a single integer t (1≤t≤100) — the number of test cases. Then follows the description of the test cases.
The first line of each test case contains two integers n, m (1≤n,m≤20) — the sizes of the carpet.
The next n lines contain m lowercase Latin letters each, describing the given carpet.
每个测试包含多个测试用例。输入的第一行包含一个整数 t(1≤t≤100),表示测试用例的数量。随后是各测试用例的描述。
每个测试用例的第一行包含两个整数 n、m(1≤n,m≤20),表示地毯的尺寸。
接下来的 n 行,每行包含 m 个小写拉丁字母,用于描述给定的地毯。
输出格式
For each set of input data, output "YES" if Vika will like the carpet, otherwise output "NO".
You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.
对于每组输入数据,如果维卡喜欢该地毯,则输出 “YES”,否则输出 “NO”。
您可以以任意大小写形式输出每个字母(小写或大写)。例如,字符串 “yEs”、“yes”、“Yes” 和 “YES” 均被视为肯定回答。
输入输出样例
输入#1
5 1 4 vika 3 3 bad car pet 4 4 vvvv iiii kkkk aaaa 4 4 vkak iiai avvk viaa 4 7 vbickda vbickda vbickda vbickda
输出#1
YES NO YES NO YES
说明/提示
In the first sample, Vika can read her name from left to right.
In the second sample, Vika cannot read the character "v", so she will not like the carpet.
在第一个样例中,Vika 可以从左到右读出她的名字。
在第二个样例中,Vika 无法读出字符 “v”,因此她不会喜欢这块地毯。
输入解题思路,AI测评打分。不知道怎么写?