結果
| 問題 |
No.3135 AAABC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-21 10:01:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 729 ms / 2,000 ms |
| コード長 | 895 bytes |
| コンパイル時間 | 407 ms |
| コンパイル使用メモリ | 82,756 KB |
| 実行使用メモリ | 140,688 KB |
| 最終ジャッジ日時 | 2025-05-02 20:50:52 |
| 合計ジャッジ時間 | 6,837 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 |
ソースコード
from itertools import combinations
N=int(input())
S=int(input())
L=[i for i in range(1,N+1)]
res=[]
for a in range(1,N-1):
for b in range(1,N-1):
c = N - a - b
if c < 1:
continue
else:
for l in combinations(L,a):
n=L.copy()
for i in l:
n.remove(i)
for m in combinations(n,b):
nn=n.copy()
for i in m:
nn.remove(i)
ans=[-1]*N
for i in l:
ans[i-1] = "A"
for i in m:
ans[i-1] = "B"
for i in nn:
ans[i-1] = "C"
res.append("".join(ans))
res=sorted(res)
try:
print(res[S-1])
except:
print(-1)