K1. MST(a.k.a. Most Shortened Terms)

Codeforces
IDCFK1
Time1000ms
Memory256MB
Difficulty
English · Original
Chinese · Translation
Formal · Original
During a programming contest, Mr. Shocking Tale (a.k.a. MST) was accused of stealing code. To prove his innocence, he shouted: "My algorithm is original! It's literally called M... S... T...!" The judges, however, noticed that every time he wrote "MST", the three-word expansion changed randomly. Was this a clever trick or just chaos? One judge even snorted: "Yesterday it was *Mangoes Squeeze Time*, today it's *Mice Sing Telepathically*... Next, you'll say it's *Minimum Spanning Tree*!" Whatever, to prove his correctness, given three words, determine if their initials form *MST* (i.e., each word starts with M, S, T in order). There are multiple test cases. The first line of the input contains a single integer $t$ $(1 <= t <= 100)$, denoting the number of test cases. For each test case: The first line contains three integers $n, m, p$ $(1 <= n, m, p <= 20)$, denoting the length of the given three words. The second line contains three strings consisting of uppercase and lowercase letters, denoting the given three words. It's guaranteed that the initials of the three words are uppercase letters. For each test case, output _YES_ if their initials form *MST*. Otherwise, output _NO_. You may print each letter in any case (_Yes, yes, Yes_ will all be recognized as a positive answer,  _No, no, nO_ will all be recognized as a negative answer). For the first sample test case, the initials of the first three words form *MST*, but the next three words form *FST*. The sample cases here are solely intended to aid understanding of the problem. *Any resemblance is purely coincidental.* ## Input There are multiple test cases. The first line of the input contains a single integer $t$ $(1 <= t <= 100)$, denoting the number of test cases. For each test case:The first line contains three integers $n, m, p$ $(1 <= n, m, p <= 20)$, denoting the length of the given three words.The second line contains three strings consisting of uppercase and lowercase letters, denoting the given three words.It's guaranteed that the initials of the three words are uppercase letters. ## Output For each test case, output _YES_ if their initials form *MST*. Otherwise, output _NO_.You may print each letter in any case (_Yes, yes, Yes_ will all be recognized as a positive answer,  _No, no, nO_ will all be recognized as a negative answer). [samples] ## Note For the first sample test case, the initials of the first three words form *MST*, but the next three words form *FST*.The sample cases here are solely intended to aid understanding of the problem. *Any resemblance is purely coincidental.*
在一次编程竞赛中,Mr. Shocking Tale(又称 MST)被指控窃取代码。为证明自己的清白,他大喊:“我的算法是原创的!它明明就叫 M... S... T...!” 然而,裁判们注意到,每次他写下“MST”时,这三个词的展开形式都会随机变化。这究竟是巧妙的诡计,还是纯粹的混乱? 一位裁判甚至嗤之以鼻:“昨天还是 *Mangoes Squeeze Time*,今天就成了 *Mice Sing Telepathically*……接下来,你是不是要说它是 *Minimum Spanning Tree* 了!?” 不管怎样,为了证明自己的正确性,给定三个单词,请判断它们的首字母是否按顺序构成 *MST*(即每个单词分别以 M、S、T 开头)。 存在多个测试用例。输入的第一行包含一个整数 $t$ $(1 lt.eq t lt.eq 100)$,表示测试用例的数量。对于每个测试用例: 第一行包含三个整数 $n, m, p$ $(1 lt.eq n, m, p lt.eq 20)$,分别表示给定的三个单词的长度。 第二行包含三个由大小写字母组成的字符串,表示给定的三个单词。 保证三个单词的首字母均为大写字母。 对于每个测试用例,如果其首字母构成 *MST*,则输出 _YES_;否则输出 _NO_。 你可以以任意大小写形式输出字母(_Yes, yes, Yes_ 均被视为正面回答,_No, no, nO_ 均被视为负面回答)。 对于第一个样例测试用例,前三个单词的首字母构成 *MST*,但后三个单词的首字母构成 *FST*。 此处的样例仅用于帮助理解题目。*任何相似之处纯属巧合。* ## Input 存在多个测试用例。输入的第一行包含一个整数 $t$ $(1 lt.eq t lt.eq 100)$,表示测试用例的数量。对于每个测试用例:第一行包含三个整数 $n, m, p$ $(1 lt.eq n, m, p lt.eq 20)$,表示给定的三个单词的长度。第二行包含三个由大小写字母组成的字符串,表示给定的三个单词。保证三个单词的首字母均为大写字母。 ## Output 对于每个测试用例,如果其首字母构成 *MST*,则输出 _YES_;否则输出 _NO_。你可以以任意大小写形式输出字母(_Yes, yes, Yes_ 均被视为正面回答,_No, no, nO_ 均被视为负面回答)。 [samples] ## Note 对于第一个样例测试用例,前三个单词的首字母构成 *MST*,但后三个单词的首字母构成 *FST*。此处的样例仅用于帮助理解题目。*任何相似之处纯属巧合。*
Let $ t $ be the number of test cases. For each test case: - Let $ n, m, p \in \mathbb{Z}^+ $ with $ 1 \leq n, m, p \leq 20 $ denote the lengths of three words. - Let $ w_1, w_2, w_3 $ be three strings over the alphabet $ \Sigma = \{ \text{uppercase and lowercase letters} \} $, with $ |w_1| = n $, $ |w_2| = m $, $ |w_3| = p $. - Let $ c_1 = \text{first character of } w_1 $, $ c_2 = \text{first character of } w_2 $, $ c_3 = \text{first character of } w_3 $. - It is guaranteed that $ c_1, c_2, c_3 $ are uppercase letters. Determine whether $ (c_1, c_2, c_3) = ('M', 'S', 'T') $. Output "YES" if true, "NO" otherwise.
API Response (JSON)
{
  "problem": {
    "name": "K1. MST(a.k.a. Most Shortened Terms)",
    "description": {
      "content": "During a programming contest, Mr. Shocking Tale (a.k.a. MST) was accused of stealing code. To prove his innocence, he shouted: \"My algorithm is original! It's literally called M... S... T...!\" The ju",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CFK1"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "During a programming contest, Mr. Shocking Tale (a.k.a. MST) was accused of stealing code. To prove his innocence, he shouted: \"My algorithm is original! It's literally called M... S... T...!\"\n\nThe ju...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "在一次编程竞赛中,Mr. Shocking Tale(又称 MST)被指控窃取代码。为证明自己的清白,他大喊:“我的算法是原创的!它明明就叫 M... S... T...!”\n\n然而,裁判们注意到,每次他写下“MST”时,这三个词的展开形式都会随机变化。这究竟是巧妙的诡计,还是纯粹的混乱?\n\n一位裁判甚至嗤之以鼻:“昨天还是 *Mangoes Squeeze Time*,今天就成了 *Mice S...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "Let $ t $ be the number of test cases.\n\nFor each test case:\n- Let $ n, m, p \\in \\mathbb{Z}^+ $ with $ 1 \\leq n, m, p \\leq 20 $ denote the lengths of three words.\n- Let $ w_1, w_2, w_3 $ be three strin...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments