Submission #164422

#TimeUsernameProblemLanguageResultExecution timeMemory
164422boolodifjenulaTavan (COCI16_tavan)Cpython 3
48 / 80
178 ms65540 KiB
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 timeMemoryGrader output
Fetching results...