Skip to content

Commit 7b10056

Browse files
Merge pull request #710 from gmlrude/main
[박희경] 110차 라이브 코테 제출
2 parents 019882d + ea3f3b3 commit 7b10056

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""
2+
회의실 개수인 줄 알았는데 회의 개수네요..
3+
"""
4+
import sys
5+
6+
input = sys.stdin.readline
7+
8+
n = int(input())
9+
times = []
10+
11+
for _ in range(n):
12+
times.append(list(map(int, input().split())))
13+
14+
# 종료 시간 기준 정렬 (같으면 시작 시간으로 정렬)
15+
times.sort(key=lambda x: (x[1], x[0]))
16+
"""
17+
[[1, 4], [3, 5], [0, 6], [5, 7], [3, 8],
18+
[5, 9], [6, 10], [8, 11], [8, 12], [2, 13], [12, 14]]
19+
"""
20+
cnt = 0
21+
end_time = 0
22+
23+
for start, end in times:
24+
if start >= end_time:
25+
cnt += 1
26+
end_time = end
27+
28+
print(cnt)
29+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
cranes = list(map(int, input().split()))
7+
m = int(input())
8+
boxes = list(map(int, input().split()))
9+
10+
cranes.sort(reverse=True)
11+
boxes.sort(reverse=True)
12+
13+
res = 0
14+
if cranes[0] < boxes[0]:
15+
print(-1)
16+
else:
17+
while boxes:
18+
for c in cranes:
19+
if boxes and c < boxes[-1]: # 시간초과 해결하는 한 줄..
20+
continue
21+
for b in boxes:
22+
if c >= b:
23+
boxes.remove(b)
24+
break
25+
res += 1
26+
print(res)

0 commit comments

Comments
 (0)