From ce519181148ecd66052b14929bd192e0f536e14b Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Tue, 24 Mar 2026 22:10:56 +0900 Subject: [PATCH] baekjoon 20260324 --- code_study/Baekjoon/python/12015.py | 22 ++++++++++++++++++++++ code_study/Baekjoon/python/15015_1.py | 15 +++++++++++++++ code_study/Baekjoon/python/2914.py | 1 + 3 files changed, 38 insertions(+) create mode 100644 code_study/Baekjoon/python/12015.py create mode 100644 code_study/Baekjoon/python/15015_1.py create mode 100644 code_study/Baekjoon/python/2914.py diff --git a/code_study/Baekjoon/python/12015.py b/code_study/Baekjoon/python/12015.py new file mode 100644 index 0000000..edc2390 --- /dev/null +++ b/code_study/Baekjoon/python/12015.py @@ -0,0 +1,22 @@ +N, A = int(input()), list(map(int, input().split())) + +LIS = [] + +for a in A : + if not len(LIS) or a > LIS[-1] : + LIS.append(a) + + else : + left, right = 0, len(LIS) - 1 + + while left < right : + mid = (left + right) // 2 + + if a > LIS[mid] : + left = mid + 1 + else : + right = mid + + LIS[left] = a + +print(len(LIS)) \ No newline at end of file diff --git a/code_study/Baekjoon/python/15015_1.py b/code_study/Baekjoon/python/15015_1.py new file mode 100644 index 0000000..30075ff --- /dev/null +++ b/code_study/Baekjoon/python/15015_1.py @@ -0,0 +1,15 @@ +from bisect import bisect_left + +N = int(input()) +A = list(map(int, input().split())) + +LIS = [] + +for a in A : + if not len(LIS) or a > LIS[-1]: + LIS.append(a) + else: + idx = bisect_left(LIS, a) + LIS[idx] = a + +print(len(LIS)) \ No newline at end of file diff --git a/code_study/Baekjoon/python/2914.py b/code_study/Baekjoon/python/2914.py new file mode 100644 index 0000000..af85e27 --- /dev/null +++ b/code_study/Baekjoon/python/2914.py @@ -0,0 +1 @@ +print((lambda A, I: A*(I-1)+1)(*list(map(int, input().split())))) \ No newline at end of file