답안 #22665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22665 2017-04-30T06:16:29 Z 이대회 트래쉬 대회에야옹(#967, dofwk1526, HUIDONG, mincl) Window XOR (KRIII5_WX) Python 3
0 / 7
1000 ms 52 KB
N, K, T = map(lambda x: int(x), input().split(' '))

X = list(map(lambda x: int(x), input().split(' ')))

repeat = []

def trans(X, K, N):
    X2 = [0] * N
    for i in range(0, N):
        x = 0
        for j in range(0, K):
            x = x ^ X[(i+j)%N]
        X2[i]=x
    return X2

def s(X):
    return list(map(lambda x: str(x), X))

ss = ""
repeat.append(s(X))
for i in range(1, T+1):
    X = trans(X, K, N)
    v = s(X)
    # print(X, i)
    if v in repeat:
        st = repeat.index(v)
        # repeat st~i
        size = i - st
        ss = ""
        r_idx = (T-st) % size
        if size == 1:
            r_idx = st
        for r in repeat[r_idx]:
            ss = ss + r + " "
        break
    repeat.append(v)
#print(repeat)

if ss == "":
    for r in repeat[len(repeat)-1]:
        ss = ss + r + " "
print(ss)

# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 3 KB Output is correct
2 Correct 35 ms 3 KB Output is correct
3 Correct 33 ms 3 KB Output is correct
4 Execution timed out 1006 ms 22 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1030 ms 52 KB Time limit exceeded
2 Halted 0 ms 0 KB -