baekjoon 20260324
This commit is contained in:
parent
b16f960c3b
commit
ce51918114
22
code_study/Baekjoon/python/12015.py
Normal file
22
code_study/Baekjoon/python/12015.py
Normal 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))
|
||||
15
code_study/Baekjoon/python/15015_1.py
Normal file
15
code_study/Baekjoon/python/15015_1.py
Normal 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))
|
||||
1
code_study/Baekjoon/python/2914.py
Normal file
1
code_study/Baekjoon/python/2914.py
Normal file
@ -0,0 +1 @@
|
||||
print((lambda A, I: A*(I-1)+1)(*list(map(int, input().split()))))
|
||||
Loading…
x
Reference in New Issue
Block a user