| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 3745 |
| 문제명 | 오름세 |
| 레벨 | 골드 2 |
| 분류 |
LIS |
| 시간복잡도 | O(nlogn) |
| 인풋사이즈 | n<=100,000 |
| 사용한 언어 | Python |
| 제출기록 | 44308KB / 140ms |
| 최고기록 | 124ms |
| 해결날짜 | 2022/06/29 |
| 태그 | |
"""Solution code for "BOJ 3745. 오름세".
- Problem link: https://www.acmicpc.net/problem/3745
- Solution link: http://www.teferi.net/ps/problems/boj/3745
Tags: [Longest increasing sequence]
"""
import bisect
def lis_length(seq):
arr = [seq[0]]
for val in seq:
if val > arr[-1]:
arr.append(val)
else:
arr[bisect.bisect_left(arr, val)] = val
return len(arr)
def main():
while True:
try:
N = int(input()) # pylint: disable=unused-variable
nums = [int(x) for x in input().split()]
except EOFError:
break
print(lis_length(nums))
if __name__ == '__main__':
main()