BOJ - 14646 - 욱제는 결정장애야!!

Updated:

import sys

def solution():
    N = int(sys.stdin.readline())
    arr = list(map(int, sys.stdin.readline().split()))

    ret = 0
    delete = 0
    check = [False for _ in range((N*2)+1)]
    sticker = []

    for i in range(len(arr)):
        if check[arr[i]] is False:
            sticker.append(arr[i])
            check[arr[i]] = True
        else:
            delete += 1
        ret = max(ret, len(sticker) - delete)
    print(ret)
solution()

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

Categories:

Updated:

Leave a comment