Skip to content

Commit eccce80

Browse files
authored
Merge pull request #639 from Yujin-Baek/main
[백유진] 93차 라이브 코테 제출
2 parents e8690c4 + 0f86390 commit eccce80

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

live9/test93/문제3/백유진.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def solution(routes):
2+
# 진출 지점을 기준으로 정렬
3+
routes.sort(key=lambda x: x[1])
4+
5+
# 첫 번째 카메라 설치
6+
camera = -30001 # 모든 경로는 -30,000 ~ 30,000 이므로 초기값 설정
7+
count = 0
8+
9+
for route in routes:
10+
if camera < route[0]: # 현재 카메라가 진입 지점보다 앞에 있다면 새로 설치
11+
camera = route[1] # 새로운 카메라는 해당 차량의 진출 지점에 설치
12+
count += 1 # 카메라 개수 증가
13+
14+
return count

0 commit comments

Comments
 (0)