提出 #22137932


ソースコード 拡げる

Copy
import sys
sys.setrecursionlimit(10 ** 9) #
def dfs(l):
# N
if len(l) == N:
print(''.join(map(str, l)))
return
#使使
maxAsc = max(l)
for a in range(97,ord(maxAsc)+2):
dfs(l+list(chr(a)))
N = int(input())
dfs(list('a'))
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
import sys
sys.setrecursionlimit(10 ** 9) #再帰回数の限界を変更

def dfs(l):
    # 数列の長さがNに達したら文字列にして出力(辞書順に出る)
    if len(l) == N:
        print(''.join(map(str, l)))
        return
    #今までに使用したアルファベットの次のアルファベットまで末尾に使用可能
    maxAsc = max(l)
    for a in range(97,ord(maxAsc)+2):
        dfs(l+list(chr(a)))
N = int(input())
dfs(list('a'))

提出情報

提出日時
問題 D - String Equivalence
ユーザ H20
言語 PyPy3 (7.3.0)
得点 400
コード長 485 Byte
結果 AC
実行時間 199 ms
メモリ 71272 KB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 2
AC × 10
セット名 テストケース
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, example0.txt, example1.txt
ケース名 結果 実行時間 メモリ
000.txt AC 62 ms 61792 KB
001.txt AC 54 ms 61868 KB
002.txt AC 51 ms 61888 KB
003.txt AC 55 ms 64400 KB
004.txt AC 69 ms 68104 KB
005.txt AC 90 ms 68976 KB
006.txt AC 113 ms 69572 KB
007.txt AC 199 ms 71272 KB
example0.txt AC 51 ms 61480 KB
example1.txt AC 52 ms 61772 KB


2025-03-31 (月)
16:35:42 +00:00