問題一覧 > 通常問題

No.3132 Encrypted Message

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 110
作問者 : ID 21712
お気に入りにしたユーザー ProblemId : 12227 / 自分の提出
問題文最終更新日: 2025-05-03 21:30:56
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 466 オムニバスコンテスト (順位表) の他の問題:
Updated 2025-05-03: Revised the explanation of the sequence $B$ for clarity

Problem Statement

This spring, you joined the competitive programming club, where exchanging encrypted messages is all the rage.

The encryption procedure is as follows.

  1. Prepare a message $S$, which is a string of length $N$ $(1\ \le\ N\ \le 100)$ consisting only of uppercase English letters.
  2. Create a sequence $A$ of length $N$ by converting the $i$-th character $S_i$ of the string $S$ into an integer $A_i$ according to the conversion table below.
    $S_i$ ABCDE FGHIJ KLMNO PQRST UVWXY Z
    $A_i$ 01234 56789 1011121314 1516171819 2021222324 25
    * The letters $A$ through $Z$ correspond, in order, to $0$ through $25$.
  3. Randomly choose $N$ values between $0$ and $1000$, inclusive, without duplicates, and arrange them in ascending order to obtain a sequence $B$ of length $N$.
  4. Generate a sequence $C$ of length $N$ from the sequences $A$ and $B$ using the formula below.
    • $C_i\ =\ 26\ \times\ B_i\ +\ A_i$ $(1\ \le\ i\ \le\ N)$
  5. Shuffle (randomly reorder) the sequence $C$ to obtain a sequence $D$ of length $N$, which is the encrypted message.

Here is a concrete example.

  1. Let the prepared message $S$ be "HELLO". Its length $N$ is $5$.
  2. Converting it according to the conversion table gives the sequence $A$ = [7,4,11,11,14].
  3. Let the sequence $B$, obtained by randomly choosing values without duplicates and arranging them in ascending order, be [2,13,45,101,617].
  4. Calculating $C_i\ =\ 26\ \times\ B_i\ +\ A_i$ gives the sequence $C$ = [59,342,1181,2637,16056].
  5. Let the sequence $D$, obtained by shuffling the sequence $C$, be [2637,1181,59,16056,342]. This is the encrypted message.

A senior member of the competitive programming club has sent you an encrypted message. Decrypt it and read the message!

Input

$N$
$D_1\ D_2\ D_3\ \dots\ D_N$

Line 1 contains the length $N$ of the message. Line 2 contains the elements of the sequence $D$ of the encrypted message, separated by spaces.

$1\ \le\ N\ \le\ 100$

$0\ \le\ D_i\ \le\ 26025$ $(1\ \le\ i\ \le\ N)$

$D_i\ \neq\ D_j$ $(1\ \le\ i\ \lt\ j\ \le\ N)$

Output

$S$

Print the decrypted message $S$ on 1 line. End the output with a newline.

Sample

Sample 1
Input
5
2637 1181 59 16056 342
Output
HELLO

This is the encrypted message from the concrete example in the problem statement. Naturally, decrypting it gives "HEELO".

Sample 2
Input
15
23687 446 22319 22848 308 17799 2276 1545 1588 14614 7986 11896 2742 9327 19008
Output
WELCOMETOCPCLUB

"WELCOME TO CP CLUB" — it seems to be a message welcoming you to the club.

Sample 3
Input
18
5579 10261 22406 16380 9696 14381 17621 11173 20684 468 9803 4721 11343 19956 293 10070 17080 20226
Output
HAPPYBIRTHDAYTOYOU

"HAPPY BIRTHDAY TO YOU" — I hear that in the competitive programming world, there is a custom of giving sequences as birthday presents...

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。