We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71a7f0c commit 0f86390Copy full SHA for 0f86390
1 file changed
live9/test93/문제3/백유진.py
@@ -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