baekjoon 20260324

This commit is contained in:
songyc macbook 2026-03-24 22:10:56 +09:00
parent b16f960c3b
commit ce51918114
3 changed files with 38 additions and 0 deletions

View File

@ -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))

View File

@ -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))

View File

@ -0,0 +1 @@
print((lambda A, I: A*(I-1)+1)(*list(map(int, input().split()))))