practivceAlgorithm/백준

[백준][Python] 11569 민준이의 계략

findTheValue 2021. 8. 15. 19:14

평범한 이분탐색을 이용한 LIS

 

import sys
input = sys.stdin.readline
from bisect import bisect_left

N = int(input())
cards = list(map(int, input().split()))

LIS = [0]
for card in cards:
    if card > LIS[-1]:
        LIS.append(card)
    else:
        LIS[bisect_left(LIS,card)] = card
print(len(LIS)-1)