Codeforces Round 659 (Div. 2)
A
Common Prefixes
Codeforces
1200
原题
←B1 →
翻译中…

The length of the longest common prefix of two strings $s = s_1 s_2 \ldots s_n$ and $t = t_1 t_2 \ldots t_m$ is defined as the maximum integer $k$ ($0 \le k \le min(n,m)$) such that $s_1 s_2 \ldots s_k$ equals $t_1 t_2 \ldots t_k$.

翻译中…

Koa the Koala initially has $n+1$ strings $s_1, s_2, \dots, s_{n+1}$.

翻译中…

For each $i$ ($1 \le i \le n$) she calculated $a_i$ — the length of the longest common prefix of $s_i$ and $s_{i+1}$.

翻译中…

Several days later Koa found these numbers, but she couldn't remember the strings.

翻译中…

So Koa would like to find some strings $s_1, s_2, \dots, s_{n+1}$ which would have generated numbers $a_1, a_2, \dots, a_n$. Can you help her?

翻译中…

If there are many answers print any. We can show that answer always exists for the given constraints.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains $t$ ($1 \le t \le 100$) — the number of test cases. Description of the test cases follows.

翻译中…

The first line of each test case contains a single integer $n$ ($1 \le n \le 100$) — the number of elements in the list $a$.

翻译中…

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 50$) — the elements of $a$.

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $100$.

翻译中…

Output

翻译中…

For each test case:

翻译中…

Output $n+1$ lines. In the $i$-th line print string $s_i$ ($1 \le |s_i| \le 200$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $s_i$ and $s_{i+1}$ has to be equal to $a_i$.

翻译中…

If there are many answers print any. We can show that answer always exists for the given constraints.

翻译中…

Note

翻译中…

In the $1$-st test case one of the possible answers is $s = [aeren, ari, arousal, around, ari]$.

翻译中…

Lengths of longest common prefixes are:

翻译中…
  • Between $\color{red}{a}eren$ and $\color{red}{a}ri$ $\rightarrow 1$
  • Between $\color{red}{ar}i$ and $\color{red}{ar}ousal$ $\rightarrow 2$
  • Between $\color{red}{arou}sal$ and $\color{red}{arou}nd$ $\rightarrow 4$
  • Between $\color{red}{ar}ound$ and $\color{red}{ar}i$ $\rightarrow 2$
翻译中…

样例

Input #1
4
4
1 2 4 2
2
5 3
3
1 3 1
3
0 0 0
Output #1
aeren
ari
arousal
around
ari
monogon
monogamy
monthly
kevinvu
kuroni
kurioni
korone
anton
loves
adhoc
problems
InputCopy OutputCopy
题目信息
题号
1384A
时间限制
1 s
内存限制
256 MB
标签
构造
贪心
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。