P18510 [CodeChef] CAB
提高-
题目描述

In the new world, we also have a new system called Cybalphabit system.
The system assigns points to each Latin lowercase alphabet as follows:-
'a' is assigned $2^{0}$ , 'b' is assigned $2^{1}$, 'c' $2^{2}$ and so on. Thus, finally 'z' is assigned $2^{25}$ points.

A Cyberstring is a sequence of lowercase Latin alphabets.

Now, the total score of a Cyberstring will be the sum of points of its characters.
You will be given two integers $N$ and $K$.
Construct a Cyberstring $X$ of length $N$ with total score $K$ or print $-1$ if it is not possible to form the Cyberstring ($X$).
If there are multiple answers, print any.

------ INPUT: ------

First line contains $T$, the number of test cases.
Each of the next $T$ lines denotes a different test case :
The ${(i+1)}^{th}$ line denotes the $i^{th}$ test case, and contains two integers $N$ and $K$, the length of the string that is to be constructed, and the score of the string respectively.

------ OUTPUT: ------

For each test case, provide the output on a different line.
Output the required string $X$, if one exists, otherwise output $-1$.

------ Constraints:- ------

$1 ≤ T ≤ 10^{5}$
$1 ≤ n ≤ 10^{5}$
$1 ≤ k ≤ 5*10^{7}$

The sum of $n$ over all test cases is less than $10^{5}$

----- Sample Input 1 ------
4
2 2
2 5
4 5
3 2
----- Sample Output 1 ------
aa
ac
baaa
-1
----- explanation 1 ------
In the first test case, $n=2$ and $k=2$. So,we have to construct a string of length $2$ with total score $2$. It can be easily seen that the only possible string is "aa". Its total score will be equal to $2^{0} + 2^{0} = 2$.

In the second case, "ac" will have score $2^{0} + 2^{2} = 5$. Obviously, "ca" will also have the same score and is also a possible answer.

In the fourth test case, it can be shown that there is no possible string which satisfies the conditions.

输入格式

见题面

输出格式

见题面

样例输入
4 2 2 2 5 4 5 3 2
样例输出
aa ac baaa -1