Scroll indicator done
728x90

https://www.acmicpc.net/problem/1700



n, k = map(int, input().split())
s = list(map(int, input().split()))
multi = [0 for i in range(n)]
cnt = 0

for i in range(k):
    noEmpty = False
    
    for j in range(n):
        if multi[j] == s[i] or multi[j] == 0:
            noEmpty = True
            multi[j] = s[i]
            break
            
    if noEmpty:
        continue
    else:
        a = 0
        for j in range(n):
            if 
            try:
                if a < s[i + 1:].index(multi[j]):
                    a = s[i + 1:].index(multi[j])
                    b = j
            except:
                a = -1
                b = j
                break
        multi[b] = s[i]
        cnt += 1
print(cnt)

 

728x90

'BAEKJOON > Python' 카테고리의 다른 글

[B11050][이항 계수 1][python]  (0) 2021.03.12
[B1259][팰린드롬수][python]  (0) 2021.03.12
[B1181][단어 정렬][python]  (0) 2021.03.10
[B3052][나머지][python]  (0) 2021.03.10
[B2908][상수][python]  (0) 2021.03.10