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 Python (3.4.3)
Score 400
Code Size 463 Byte
Status AC
Exec Time 264 ms
Memory 4340 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 10
Set Name Test Cases
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
Case Name Status Exec Time Memory
000.txt AC 18 ms 3060 KB
001.txt AC 18 ms 3064 KB
002.txt AC 18 ms 3064 KB
003.txt AC 18 ms 3064 KB
004.txt AC 20 ms 3188 KB
005.txt AC 30 ms 3300 KB
006.txt AC 62 ms 3352 KB
007.txt AC 264 ms 4340 KB
example0.txt AC 18 ms 3064 KB
example1.txt AC 18 ms 3064 KB