406435: GYM102409 G Ironical Solution 2

Memory Limit:256 MB Time Limit:3 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Ironical Solution 2time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Diego wants to message his friend Ketzia, for this he will first grab a word and encode it as numbers and then apply some encryption to the numbers and send it to her. Ironically, after coming up with this solution he realized that this system has to send word by word, only works for words were every letter is in alphabetical order and also there are many chat services that are free and will encrypt messages securely so there was no need to invent this encryption system.

In order to encrypt Diego will first grab a word of $$$N$$$ characters and convert every character into its numerical ASCII (for example 'A' -> 65, '0' -> 48, 'a' -> 97). After that he will have exactly $$$N$$$ positive numbers.

Given those $$$N$$$ numbers, he will generate all possible $$$2^N$$$ subsets and then for each subset get the sum of all the numbers in the subset, he will then sort the sums and send them to Ketzia. She will decrypt the message by doing the inverse of the encryption steps.

For this particular problem, he will do the decryption of the message.

Input

An integer $$$N$$$ $$$(1 \le N \le 20)$$$, the amount of characters the word Diego sent Ketzia originally had.

Followed by 1 line with $$$2^N$$$ integers $$$(0<=a_i<=2440)$$$, all the sorted sums of all possible subsets of the $$$N$$$ numbers generated by converting all characters to their ASCII representation of the original word.

Output

A single line with exactly $$$N$$$ alphanumeric characters sorted in non-decreasing order by ASCII value, the original word Diego sent Ketzia.

ExampleInput
5
0 66 101 101 114 121 167 167 180 187 202 215 215 222 222 235 268 281 281 288 288 301 316 323 336 336 382 389 402 402 437 503
Output
Beery

Source/Category

加入题单

算法标签: