Submission #10831772


Source Code Expand

Copy
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

alphabets = [chr(ord('a') + x) for x in range(26)]

def dfs(S, i):
    if len(S) == N:
        yield ''.join(S)
        return
    for j in range(i):
        for w in dfs(S + [alphabets[j]], i):
            yield w
    for w in dfs(S + [alphabets[i]], i + 1):
        yield w

for w in dfs([],0):
    print(w)

Submission Info

Submission Time
Task D - String Equivalence
User maspy
Language Python3 (3.4.3)
Score 400
Code Size 463 Byte
Status
Exec Time 264 ms
Memory 4340 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example0.txt, example1.txt
All 400 / 400 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt 18 ms 3060 KB
001.txt 18 ms 3064 KB
002.txt 18 ms 3064 KB
003.txt 18 ms 3064 KB
004.txt 20 ms 3188 KB
005.txt 30 ms 3300 KB
006.txt 62 ms 3352 KB
007.txt 264 ms 4340 KB
example0.txt 18 ms 3064 KB
example1.txt 18 ms 3064 KB