-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsenha.py
More file actions
37 lines (28 loc) · 728 Bytes
/
Copy pathsenha.py
File metadata and controls
37 lines (28 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Password, 2021 Brazilian Informatics Olympiad
# Available @ https://olimpiada.ic.unicamp.br/pratique/p2/2021/f2/senha/
def pwd(password, i):
for j in range(k):
temp = []
for f in range(n):
temp.append(password[f])
temp[index[i]] = words[i][j]
if i == (m - 1):
possi.append(temp)
else:
pwd(temp, i + 1)
return
n, m, k = [int(i) for i in input().split()]
senha = list(str(input()))
words = []
possi = []
index = []
for i in range(m): #Palavras
temp0 = list(str(input()))
words.append(temp0)
p = int(input())
for i in range(n): #Indices das letras desconhecidas
if senha[i] == '#':
index.append(i)
pwd(senha, 0)
possi.sort()
print(''.join(possi[p - 1]))