first commit

from old repository to a new repository
This commit is contained in:
Gyubin Han
2024-04-30 16:59:10 +09:00
commit 2600340c03
93 changed files with 1610 additions and 0 deletions

38
boj/2568.py Normal file
View File

@@ -0,0 +1,38 @@
import bisect
from sys import stdin
input=stdin.readline
n=int(input())
arr=[]
for i in range(n):
inp=tuple(map(int,input().split()))
arr.append(inp)
arr.sort(key=lambda x:x[1])
l=[0]
lt=[(0,0)]
for i in arr:
a,b=i
if l[-1]<a:
l.append(a)
lt.append((a,len(l)-1))
else:
p=bisect.bisect_left(l,a)
l[p]=a
lt.append((a,p))
target=len(l)-1
darr=[]
for i in lt[::-1]:
if i[1]==target:
target-=1
else:
darr.append(i[0])
# print(darr)
darr.sort()
print(len(darr))
for i in darr:
print(i)