# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164422 | boolodifjenula | Tavan (COCI16_tavan) | Cpython 3 | 178 ms | 65540 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
from itertools import *
N,M,K,X=map(int,input().split())
r=input()
L=[]
for i in range(M):
L+=[input()]
m=[]
for i in range(N):
if r[i]=="#": m+=[i]
R1=[i for i in range (K)]
R=list(combinations_with_replacement(R1,M))
R1.reverse()
R+=list(combinations(R1,M))
R1=[]
C=[]
for i in range(K**M):
for j in range(M):
r=r[:m[j]]+L[j][R[i][j]]+r[m[j]+1:]
C+=[r]
C.sort()
print(C[X-1])
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |