Submission #712781

#TimeUsernameProblemLanguageResultExecution timeMemory
712781ProximitynowType Printer (IOI08_printer)Cpython 3
10 / 100
1087 ms12020 KiB
from itertools import permutations n = int(input()) words = [input() for _ in range(n)] best = [] for per in permutations(words): m = [] printer = '' for i in per: r = len(printer) for j in range(len(printer)): if j > len(i) or printer[j] != i[j]: r = len(printer) - j break m.extend(['-'] * r) m.extend([j for j in i[-(len(i) - (len(printer) - r)):]]) printer = i m.append('P') if len(best) == 0 or len(m) < len(best): best = m print(len(best)) for i in best: print(i)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...