No.2034 Anti Lexicography
タグ : / 解いたユーザー数 236
作問者 :
milkcoffee
/ テスター :
nok0
riano
Problem Statement
You are given a string $S$ of length $N$ consisting of lowercase English letters.
Arrange all $26^N$ strings of length $N$ consisting of lowercase English letters in lexicographical order.
Supposing that $S$ is the $k$-th string from the front in lexicographical order, output the string that is the $k$-th from the back.
Input
$N$ $S$
- $1 \leq N \leq 2 \times 10^5$
- $N$ is an integer.
- $S$ is a string of length $N$ consisting of lowercase English letters.
Output
Output the answer string on $1$ line.
Sample
Sample 1
Input
3 aab
Output
zzy
Arranging the strings of length $3$ consisting of lowercase English letters in lexicographical order gives $aaa,aab,aac,\dots,zzy,zzz$.
Since $aab$ is the $2$-nd string from the front, output $zzy$, which is the $2$-nd string from the back.
Sample 2
Input
1 n
Output
m
Sample 3
Input
9 bfprxlwvi
Output
yukicoder
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。