CF1384A.Common Prefixes
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The length of the longest common prefix of two strings s=s1s2…sn and t=t1t2…tm is defined as the maximum integer k ( 0≤k≤min(n,m) ) such that s1s2…sk equals t1t2…tk .
Koa the Koala initially has n+1 strings s1,s2,…,sn+1 .
For each i ( 1≤i≤n ) she calculated ai — the length of the longest common prefix of si and si+1 .
Several days later Koa found these numbers, but she couldn't remember the strings.
So Koa would like to find some strings s1,s2,…,sn+1 which would have generated numbers a1,a2,…,an . Can you help her?
If there are many answers print any. We can show that answer always exists for the given constraints.
输入格式
Each test contains multiple test cases. The first line contains t ( 1≤t≤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≤n≤100 ) — the number of elements in the list a .
The second line of each test case contains n integers a1,a2,…,an ( 0≤ai≤50 ) — the elements of a .
It is guaranteed that the sum of n over all test cases does not exceed 100 .
输出格式
For each test case:
Output n+1 lines. In the i -th line print string si ( 1≤∣si∣≤200 ), consisting of lowercase Latin letters. Length of the longest common prefix of strings si and si+1 has to be equal to ai .
If there are many answers print any. We can show that answer always exists for the given constraints.
输入输出样例
输入#1
4 4 1 2 4 2 2 5 3 3 1 3 1 3 0 0 0
输出#1
aeren ari arousal around ari monogon monogamy monthly kevinvu kuroni kurioni korone anton loves adhoc problems
说明/提示
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 aeren and ari →1
- Between ari and arousal →2
- Between arousal and around →4
- Between around and ari →2