제출 #164428

#제출 시각아이디문제언어결과실행 시간메모리
164428boolodifjenulaTavan (COCI16_tavan)Cpython 3
0 / 80
171 ms65540 KiB
from itertools import * N,M,K,X=map(int,input().split()) r=input() r1=r 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)) C=[] for i in range(K**M): r="m" for j in range(M): r=r[:]+L[j][R[i][j]] R[i]=r R.sort() for i in range(M): r1=r1[:m[i]]+R[X-1][i+1]+r1[m[i]+1:] print(r1)
#Verdict Execution timeMemoryGrader output
Fetching results...