N, K = [ int(i) for i in input().split() ]
words = []
for i in range(N):
words.append(input())
def test():
for index, words in enumerate(sub_word):
# print(sub_word)
# print()
if words[0] == 0:
words[0] = 1
for i in sub_word[index + 1:]:
for j in i[1:]:
if j in words[1:]:
if i[0] == words[0]:
return False
elif words[0] == 1:
i[0] = 2
else:
i[0] = 1
return True
sub_word = []
for index, word in enumerate(words):
sub_word.append([])
sub_word[index].append(0)
for length in range(K, len(word)+1):
for i in range(len(word) - length + 1):
sub_word[index].append(word[i:i+length])
#sub_word.append(words[word])
#print(sub_word)
if test():
print("Yes")
for i in sub_word:
print(i[0])
else:
print("No")
#print(sub_word)
#print("Yes")
#for i in sub_word:
# print(i[0])
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
3 KB |
Output is correct |
2 |
Correct |
28 ms |
3 KB |
Output is correct |
3 |
Correct |
38 ms |
3 KB |
Output is correct |
4 |
Correct |
32 ms |
3 KB |
Output is correct |
5 |
Correct |
27 ms |
3 KB |
Output is correct |
6 |
Correct |
73 ms |
4 KB |
Output is correct |
7 |
Execution timed out |
1046 ms |
4 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |