E. Adnan and the Burned drivers

Codeforces
IDCF10216E
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Adnan is training the ARC team in NCD, but he wants to challenge them, so he started burning their drivers. The team has $N$ drivers. Each driver has a lowercase Latin letter written on it. A segment of drivers from $L$ to $R$ can be used to move the robot if this segment is palindrome. When Adnan burns a driver, he changes the letter to any other letter he wants. A segment of letters is considered palindrome if it can be read the same way from right and left. For example, $a a$, $a b c b a$, and $m m m$ are palindromes. But $m m a$ and $a a m a$ aren't. You will be given $E$ events in order; these events are of two kinds: $1$ $i$ $c$: Adnan will burn the $i_{t h}$ driver to change its letter to the char $c$. $2$ $l$ $r$: The ARC team will use the segment [$l$,$r$], print "Adnan Wins" if this segment is palindrome, and "ARCNCD!" otherwise. First line of input will be $T$, number of test cases Each test case begins with two numbers $N, E$ the number of drivers, and the number of events. Followed by a string of length $N$ consisting of only lowercase Latin letters. Next $E$ lines contains $3$ space separated integers, the queries as described above. $1 <= N, E <= 10^5$ It's guaranteed there is at least one query of the second type. For every query of the second type, print "Adnan Wins" or "ARCNCD!" ## Input First line of input will be $T$, number of test casesEach test case begins with two numbers $N, E$ the number of drivers, and the number of events. Followed by a string of length $N$ consisting of only lowercase Latin letters.Next $E$ lines contains $3$ space separated integers, the queries as described above.$1 <= N, E <= 10^5$It's guaranteed there is at least one query of the second type. ## Output For every query of the second type, print "Adnan Wins" or "ARCNCD!" [samples]
**Definitions** Let $ T \in \mathbb{Z} $ be the number of test cases. For each test case: - Let $ N, E \in \mathbb{Z} $ denote the number of drivers and number of events. - Let $ S = s_1 s_2 \dots s_N $ be a string of length $ N $, where $ s_i \in \{a, b, \dots, z\} $ represents the letter on driver $ i $. - Let $ Q = \{q_1, q_2, \dots, q_E\} $ be a sequence of $ E $ events, where each $ q_j $ is one of: - Type 1: $ (1, i, c) $ — update $ s_i \leftarrow c $, - Type 2: $ (2, l, r) $ — query whether substring $ s[l:r] $ is a palindrome. **Constraints** 1. $ 1 \le T \le 10 $ (implied by constraints, though not explicitly bounded; standard assumption) 2. $ 1 \le N, E \le 10^5 $ 3. For all updates: $ 1 \le i \le N $, $ c \in \{a, b, \dots, z\} $ 4. For all queries: $ 1 \le l \le r \le N $ **Objective** For each query $ (2, l, r) $: Output "Adnan Wins" if $ s_l s_{l+1} \dots s_r $ is a palindrome, i.e., $$ \forall k \in \{0, 1, \dots, r-l\}, \quad s_{l+k} = s_{r-k} $$ Otherwise, output "ARCNCD!".
API Response (JSON)
{
  "problem": {
    "name": "E. Adnan and the Burned drivers",
    "description": {
      "content": "Adnan is training the ARC team in NCD, but he wants to challenge them, so he started burning their drivers. The team has $N$ drivers. Each driver has a lowercase Latin letter written on it. A segment",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10216E"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Adnan is training the ARC team in NCD, but he wants to challenge them, so he started burning their drivers.\n\nThe team has $N$ drivers. Each driver has a lowercase Latin letter written on it. A segment...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case:  \n- Let $ N, E \\in \\mathbb{Z} $ denote the number of drivers and number of events.  \n- Let $ S = s_1 s_2 \\...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments