K. Know Your Statement

Codeforces
IDCF10162K
Time2000ms
Memory512MB
Difficulty
English · Original
Formal · Original
Lucas really wanted to create an interesting problem with strings, but he spent so much time thinking that he ended up with no creativity to create a better statement for this problem. The problem he came up with is the following: Given an array v of strings, answer these queries: In the first line of input, there is an integer n (1 ≤ n ≤ 105) indicating the size of the array v. The following n lines display the contents of the array, where the (i + 1)-th line is the string in the i-th position in the array. In the (n + 2)-th line, there is an integer q (1 ≤ q ≤ 105), the number of queries to be executed. The following q lines contain the description of the q queries, one per line. Each query is described as follows: For each query of type 2 and 3, print "_Y_" if the query's answer is true or "_N_" if it's false. ## Input In the first line of input, there is an integer n (1 ≤ n ≤ 105) indicating the size of the array v. The following n lines display the contents of the array, where the (i + 1)-th line is the string in the i-th position in the array.In the (n + 2)-th line, there is an integer q (1 ≤ q ≤ 105), the number of queries to be executed. The following q lines contain the description of the q queries, one per line.Each query is described as follows: Type 1: 1 i s, where i is an integer (1 ≤ i ≤ n) and s is a string. Type 2: 2 l r s, where l and r are integers (1 ≤ l ≤ r ≤ n) and s is a string. Type 3: 3 l r s, where l and r are integers (1 ≤ l ≤ r ≤ n) and s is a string. ## Output For each query of type 2 and 3, print "_Y_" if the query's answer is true or "_N_" if it's false. [samples] ## Note The sum of the lengths of the strings initially in the array does not exceed 5 * 105. The sum of the lengths of the strings in the queries does not exceed 5 * 105. All strings contain only lower case characters. String a is a prefix of string b if: .
**Definitions** Let $ n \in \mathbb{Z} $ be the size of the array $ V = (s_1, s_2, \dots, s_n) $, where each $ s_i \in \Sigma^* $ is a string over some alphabet $ \Sigma $. Let $ q \in \mathbb{Z} $ be the number of queries. **Constraints** 1. $ 1 \le n \le 10^5 $ 2. $ 1 \le q \le 10^5 $ 3. Each query is of type 1, 2, or 3 (implied by context, though not fully specified). 4. For queries of type 2 and 3, output "_Y_" if true, "_N_" if false. **Objective** Process $ q $ queries on array $ V $; for each query of type 2 or 3, output "_Y_" or "_N_" based on the query's condition (unspecified).
API Response (JSON)
{
  "problem": {
    "name": "K. Know Your Statement",
    "description": {
      "content": "Lucas really wanted to create an interesting problem with strings, but he spent so much time thinking that he ended up with no creativity to create a better statement for this problem. The problem he",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 524288
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10162K"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Lucas really wanted to create an interesting problem with strings, but he spent so much time thinking that he ended up with no creativity to create a better statement for this problem.\n\nThe problem he...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the size of the array $ V = (s_1, s_2, \\dots, s_n) $, where each $ s_i \\in \\Sigma^* $ is a string over some alphabet $ \\Sigma $.  \nLet $ q \\in \\mathbb{Z} ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments