H. Peace of AmericaReunion

Codeforces
IDCF10051H
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You are given an encrypted string, encrypted using a certain algorithm. Decrypt it ! The first line of input contains 26 integers a1, ..., a26 separated by space (1 ≤ ai ≤ 105). Next lines, each line contains an integer between 1 and 105 inclusive. Print a single string in a single line. ## Input The first line of input contains 26 integers a1, ..., a26 separated by space (1 ≤ ai ≤ 105).Next lines, each line contains an integer between 1 and 105 inclusive. ## Output Print a single string in a single line. [samples]
**Definitions** Let $ A = (a_1, a_2, \dots, a_{26}) \in \mathbb{Z}^{26} $ be a sequence of integers where $ 1 \leq a_i \leq 10^5 $ for all $ i \in \{1, \dots, 26\} $. Let $ B = (b_1, b_2, \dots, b_m) \in \mathbb{Z}^m $ be a sequence of integers where each $ b_j \in [1, 10^5] $, and $ m $ is the number of subsequent input lines. **Constraints** 1. $ 1 \leq a_i \leq 10^5 $ for all $ i \in \{1, \dots, 26\} $ 2. $ 1 \leq b_j \leq 10^5 $ for all $ j \in \{1, \dots, m\} $ **Objective** Decrypt the sequence $ B $ into a string $ S $ of length $ m $, where each $ b_j $ maps to the $ a_i $-th letter of the alphabet (i.e., the letter corresponding to the $ i $-th smallest value in $ A $). Specifically: - Sort $ A $ to obtain the sorted sequence $ A' = (a_{(1)}, a_{(2)}, \dots, a_{(26)}) $, where $ a_{(1)} < a_{(2)} < \dots < a_{(26)} $. - Let $ \sigma $ be the permutation such that $ a_{\sigma(i)} = a_{(i)} $. - For each $ b_j $, find the unique $ i \in \{1, \dots, 26\} $ such that $ b_j = a_{\sigma(i)} $, and output the $ i $-th letter of the English alphabet (i.e., 'a' for $ i=1 $, 'b' for $ i=2 $, ..., 'z' for $ i=26 $). Output the resulting string $ S = s_1 s_2 \dots s_m $, where $ s_j $ is the letter corresponding to $ b_j $ under the above mapping.
API Response (JSON)
{
  "problem": {
    "name": "H. Peace of AmericaReunion",
    "description": {
      "content": "You are given an encrypted string, encrypted using a certain algorithm. Decrypt it ! The first line of input contains 26 integers a1, ..., a26 separated by space (1 ≤ ai ≤ 105). Next  lines, each ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10051H"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given an encrypted string, encrypted using a certain algorithm. Decrypt it !\n\nThe first line of input contains 26 integers a1, ..., a26 separated by space (1 ≤ ai ≤ 105).\n\nNext  lines, each li...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ A = (a_1, a_2, \\dots, a_{26}) \\in \\mathbb{Z}^{26} $ be a sequence of integers where $ 1 \\leq a_i \\leq 10^5 $ for all $ i \\in \\{1, \\dots, 26\\} $.  \nLet $ B = (b_1, b_2, \\dots, b...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments