logo AlgoBeat OnlineJudge
登录 注册

#216207. [ICPC 2017 NAIPC] Incremental Double Free Strings

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

A string is called double free if no two adjacent letters are the same.

A string is called -incremental if for all values of in the range , there exists exactly one character with occurrences, and the string’s length is . For example, if , then a 3-incremental string should have one character appear once, another twice, another three times, in any order, for a total string length of .

A string is both -incremental and double free if it meets both these criteria. Now consider examining all such strings of lowercase letters for a given in alphabetical order. Consider the following examples.

: aba, aca, ada, , aya, aza, bab, bcb, bdb, , zxz, zyz

: ababac, ababad, , ababay, ababaz, ababca, , zyzyzx

What is the string in an alphabetized list of all -incremental, double free strings?

输入格式

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. There will be exactly one line of input. It will contain two integers, and (), which is asking for the string in the alphabetically sorted list of all -incremental, double free strings.

输出格式

Output the -incremental, double free string in the alphabetized list. If no such string exists, output .

样例

样例输入 1

2 650

样例输出 1

zyz

样例输入 2

2 651

样例输出 2

-1

样例输入 3

5 12345678901234

样例输出 3

yuzczuyuyuzuyci