{"problem":{"name":"P. Proooooooooooooofer","description":{"content":"You are given an encrypted string, encrypted using a certain algorithm. Decrypt it! Encryption algorithm gives a string t of length n and converts it to a pair (s, a) where s is a string of length n ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10051P"},"statements":[{"statement_type":"Markdown","content":"You are given an encrypted string, encrypted using a certain algorithm. Decrypt it!\n\nEncryption algorithm gives a string t of length n and converts it to a pair (s, a) where s is a string of length n and a is a sequence of integers of length n - 2.\n\nThe first line, contains an integer n. (3 ≤ n ≤ 105).\n\nThe second line, contains string s. The third line contains n - 2 integers a1, a2, ..., an - 2 seperated by space.\n\nEach character of s is a lower case English letter (1 ≤ ai ≤ n and 1 ≤ i ≤ n - 2).\n\nPrint t in the only line of output.\n\n## Input\n\nThe first line, contains an integer n. (3 ≤ n ≤ 105).The second line, contains string s. The third line contains n - 2 integers a1, a2, ..., an - 2 seperated by space.Each character of s is a lower case English letter (1 ≤ ai ≤ n and 1 ≤ i ≤ n - 2).\n\n## Output\n\nPrint t in the only line of output.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ with $ 3 \\leq n \\leq 10^5 $.  \nLet $ s \\in \\Sigma^n $ be a string over $ \\Sigma = \\{a, b, \\dots, z\\} $.  \nLet $ a = (a_1, a_2, \\dots, a_{n-2}) \\in \\mathbb{Z}^{n-2} $ with $ 1 \\leq a_i \\leq n $.\n\n**Constraints**  \n1. $ 3 \\leq n \\leq 10^5 $  \n2. $ s $ consists of lowercase English letters.  \n3. $ 1 \\leq a_i \\leq n $ for all $ i \\in \\{1, \\dots, n-2\\} $\n\n**Objective**  \nRecover the original string $ t \\in \\Sigma^n $ such that the encryption process producing $ (s, a) $ from $ t $ is inverted.  \n*(The encryption algorithm is implied to be: for $ i = 1 $ to $ n-2 $, $ a_i $ is the 1-based index in $ t $ of the character that was removed at step $ i $, and $ s $ is the sequence of removed characters. Thus, decryption reconstructs $ t $ by inserting each character $ s_i $ back into position $ a_i $ in an initially empty or placeholder array.)*\n\nFormally, reconstruct $ t $ such that:  \n- Initialize an array $ t $ of $ n $ placeholders.  \n- For each $ i \\in \\{1, \\dots, n-2\\} $, place $ s_i $ at position $ a_i $ in $ t $.  \n- The two remaining positions in $ t $ (not assigned by any $ a_i $) are filled with the last two characters of $ s $, in order, into the unassigned indices in increasing order.  \n\nThen output $ t $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10051P","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}