結果
問題 | No.3135 AAABC |
ユーザー |
![]() |
提出日時 | 2025-05-02 21:53:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 837 ms / 2,000 ms |
コード長 | 408 bytes |
コンパイル時間 | 345 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 123,332 KB |
最終ジャッジ日時 | 2025-05-02 21:53:27 |
合計ジャッジ時間 | 7,480 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
N=int(input()) S=int(input()) a=[] for i in range(3**N): l=[] for j in range(N): if (i//(3**j))%3==0: l.append("A") elif (i//(3**j))%3==1: l.append("B") else: l.append("C") if ("A" not in l) or ("B" not in l) or ("C" not in l): continue a.append("".join(l)) a.sort() if len(a) < S: print(-1) else: print(a[S-1])