Algorithm/boj

[파이썬] 12015, 12738 가장 긴 증가하는 부분 수열 2, 3

takeU 2022. 6. 13. 18:43
반응형
from bisect import bisect_left

n = int(input())
li = list(map(int, input().split()))
dp = []

for l in li:
    cur = bisect_left(dp, l)
    if len(dp) <= cur:
        dp.append(l)
    else:
        dp[cur] = l

print(len(dp))

dp, LIS