020. Codebusters

Codeforces
IDCF10269020
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Encryption has been an essential tool throughout history and the modern world. Essentially, encryption is the practice of encoding messages, for the purposes of securing the message's confidentiality from other parties. Your Job is to create a basic encryption method, where if we cast characters of a word to an integer, the odds will be swapped with its following even character, where the first positive integer _n_ are the number of cases following it. (If the word is of an odd length, the last character should be the same) ## Input Your Job is to create a basic encryption method, where if we cast characters of a word to an integer, the odds will be swapped with its following even character, where the first positive integer _n_ are the number of cases following it. [samples] ## Note (If the word is of an odd length, the last character should be the same)
**Definitions** Let $ n \in \mathbb{Z} $ be the number of test cases. For each test case $ k \in \{1, \dots, n\} $, let $ w_k = (c_{k,1}, c_{k,2}, \dots, c_{k,\ell_k}) $ be a string of length $ \ell_k $, where each $ c_{k,i} $ is a character. Let $ a_{k,i} \in \mathbb{Z} $ denote the integer value (e.g., ASCII) of character $ c_{k,i} $. **Constraints** 1. $ 1 \leq n \leq \text{some bound (unspecified)} $ 2. For each $ k $, $ \ell_k \geq 1 $, and $ a_{k,i} $ is the integer representation of $ c_{k,i} $. **Objective** For each string $ w_k $, produce an encrypted string $ w_k' = (c_{k,1}', c_{k,2}', \dots, c_{k,\ell_k}') $, where: $$ a_{k,i}' = \begin{cases} a_{k,i+1} & \text{if } i \text{ is odd and } i < \ell_k, \\ a_{k,i-1} & \text{if } i \text{ is even}, \\ a_{k,i} & \text{if } i = \ell_k \text{ and } \ell_k \text{ is odd}. \end{cases} $$ Then, $ c_{k,i}' $ is the character corresponding to $ a_{k,i}' $.
API Response (JSON)
{
  "problem": {
    "name": "020. Codebusters",
    "description": {
      "content": "Encryption has been an essential tool throughout history and the modern world. Essentially, encryption is the practice of encoding messages, for the purposes of securing the message's confidentiality ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269020"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Encryption has been an essential tool throughout history and the modern world. Essentially, encryption is the practice of encoding messages, for the purposes of securing the message's confidentiality ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, n\\} $, let $ w_k = (c_{k,1}, c_{k,2}, \\dots, c_{k,\\ell_k}) $ be a string of length $ \\e...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments