問題一覧 > 通常問題

No.3135 AAABC

レベル : / AI推定難易度 : 162 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 93
作問者 : urunea / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 12199 / 自分の提出
問題文最終更新日: 2025-04-26 14:56:42
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 466 オムニバスコンテスト (順位表) の他の問題:

Problem Statement

Consider strings of length $N$ consisting only of A, B, C, in which each of the characters is used at least once.

Among all such strings, output the $S$-th one in lexicographically increasing order.

If there is no such string, output -1.

Input

$N$
$S$


$3 \le N \le 12$

$1 \le S \le 10^6$

All inputs are given as integers.

Output

Output the answer to standard output in $1$ line.

Sample

Sample 1
Input
5
1
Output
AAABC

Sample 2
Input
3
6
Output
CBA

Sample 3
Input
5
151
Output
-1

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。