No.3419 Ars magna
問題文最終更新日: 2026-01-11 12:49:31
English (AI translation)
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もしくは右上の雲マークをクリックしてアカウントを作成してください。
まみめ
kidodesu