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 i in range(len(word) - K + 1):
sub_word[index].append(word[i:i+K])
#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])
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
3 KB |
Output is correct |
2 |
Correct |
27 ms |
3 KB |
Output is correct |
3 |
Correct |
26 ms |
3 KB |
Output is correct |
4 |
Correct |
25 ms |
3 KB |
Output is correct |
5 |
Correct |
27 ms |
3 KB |
Output is correct |
6 |
Correct |
28 ms |
3 KB |
Output is correct |
7 |
Correct |
103 ms |
3 KB |
Output is correct |
8 |
Correct |
96 ms |
3 KB |
Output is correct |
9 |
Incorrect |
98 ms |
3 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |