평범한 이분탐색을 이용한 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)
'practivceAlgorithm > 백준' 카테고리의 다른 글
[백준][Python] 1305 광고 (0) | 2021.08.16 |
---|---|
[백준][Python] 16988 바둑2 (0) | 2021.08.16 |
[백준][Python] 14627 파닭파닭 (0) | 2021.08.15 |
[백준][Python] 15723 n단 논법 (0) | 2021.08.12 |
[백준][Python] 11265 끝나지 않는 파티 (0) | 2021.08.12 |