問題一覧 > 通常問題

No.3419 Ars magna

レベル : / AI推定難易度 : 101 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 105
作問者 : syndrome / テスター : まみめ harel hirayuu_yc rogi52 👑 qand kidodesu 👑 ArcAki Eku
お気に入りにしたユーザー ProblemId : 12883 / 自分の提出
問題文最終更新日: 2026-01-11 12:49:31
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 YNUCPC Contest 2 (順位表) の他の問題:

Problem Statement

You are given a string $S$ of length $N$ and a permutation $P = (P_1, P_2, ..., P_N)$ of $(1,2,...,N)$.

For all $i$ $(1 \leq i \leq N)$, simultaneously replace the $i$-th character of $S$ with the $P_i$-th character of $S$, and output the resulting string $S$.

Input

The input is given from standard input in the following format.

$N$
$S$
$P_1\;P_2\;...\;P_N$
  • $1 \leq N \leq 100$
  • $S$ is a string of length $N$ consisting of lowercase English letters
  • $1 \leq P_i \leq N$ $(1 \leq i \leq N)$
  • $P_i \neq P_j$ $(i \neq j)$

Output

Output the string $S$ after the replacement.

Sample

Sample 1
Input
8
anagrams
3 5 8 7 1 4 2 6
Output
arsmagna
Sample 2
Input
8
triangle
3 5 1 8 6 2 4 7
Output
integral

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