結果

問題 No.3135 AAABC
ユーザー Cecil
提出日時 2025-05-02 23:05:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 413 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 82,652 KB
実行使用メモリ 172,128 KB
最終ジャッジ日時 2025-05-02 23:05:42
合計ジャッジ時間 5,124 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
N = int(input())
S = int(input())
L = list()
for bit in product([0,1,2],repeat=N):
    if 0 in bit and 1 in bit and 2 in bit:
        L.append(bit)
L.sort()
if len(L)<S:
    print(-1)
    exit()
ans = ""
for i in L[S-1]:
    if i==0:
        ans += "A"
    elif i==1:
        ans += "B"
    else:
        ans += "C"
print(ans)
0