Upload files to "백준"
This commit is contained in:
26
백준/11000.py
Normal file
26
백준/11000.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import sys
|
||||||
|
import heapq
|
||||||
|
|
||||||
|
input = sys.stdin.readline
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
|
||||||
|
table = []
|
||||||
|
|
||||||
|
for _ in range(n):
|
||||||
|
start, end = map(int, input().split())
|
||||||
|
table.append((start, end))
|
||||||
|
|
||||||
|
table.sort()
|
||||||
|
|
||||||
|
rooms = []
|
||||||
|
|
||||||
|
heapq.heappush(rooms, table[0][1])
|
||||||
|
|
||||||
|
for i in range(1, n):
|
||||||
|
if table[i][0] >= rooms[0]:
|
||||||
|
heapq.heappop(rooms)
|
||||||
|
|
||||||
|
heapq.heappush(rooms, table[i][1])
|
||||||
|
|
||||||
|
print(len(rooms))
|
||||||
10
백준/11004.py
Normal file
10
백준/11004.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
input = sys.stdin.readline
|
||||||
|
|
||||||
|
N, K = map(int,(input().split(' ')))
|
||||||
|
arr = list(map(int, input().split(' ')))
|
||||||
|
|
||||||
|
arr.sort()
|
||||||
|
|
||||||
|
print(arr[K-1])
|
||||||
16
백준/11051.Py
Normal file
16
백준/11051.Py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
input = sys.stdin.readline
|
||||||
|
N, K = map(int, input().split())
|
||||||
|
D = [[0 for j in range(N+1)] for i in range(N+1)]
|
||||||
|
|
||||||
|
for i in range(0, N+1):
|
||||||
|
D[i][0] = 1
|
||||||
|
D[i][i] = 1
|
||||||
|
D[i][1] = i
|
||||||
|
|
||||||
|
for i in range(1, N+1):
|
||||||
|
for j in range(1, i+1):
|
||||||
|
D[i][j] = (D[i-1][j-1] % 10007 + D[i-1][j] %10007)%10007
|
||||||
|
|
||||||
|
print(D[N][K])
|
||||||
15
백준/11055.py
Normal file
15
백준/11055.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
input = sys.stdin.readline
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
|
||||||
|
lst = list(map(int, input().split()))
|
||||||
|
DP = [lst[i] for i in range(n)]
|
||||||
|
|
||||||
|
for i in range(n):
|
||||||
|
for j in range(i):
|
||||||
|
if lst[i] > lst[j]:
|
||||||
|
DP[i] = max(DP[i], DP[j]+lst[i])
|
||||||
|
|
||||||
|
print(max(DP))
|
||||||
14
백준/11286.py
Normal file
14
백준/11286.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import sys
|
||||||
|
from queue import PriorityQueue
|
||||||
|
|
||||||
|
pq = PriorityQueue()
|
||||||
|
num = int(sys.stdin.readline().rstrip())
|
||||||
|
|
||||||
|
for i in range(num):
|
||||||
|
temp = int(sys.stdin.readline().rstrip())
|
||||||
|
if(temp==0 and pq.empty()):
|
||||||
|
print('0')
|
||||||
|
elif(temp==0):
|
||||||
|
print(pq.get()[1])
|
||||||
|
else:
|
||||||
|
pq.put((abs(temp),temp))
|
||||||
Reference in New Issue
Block a user